sec1/
lib.rs

1#![no_std]
2#![cfg_attr(docsrs, feature(doc_auto_cfg))]
3#![doc = include_str!("../README.md")]
4#![doc(
5    html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
6    html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
7)]
8#![forbid(unsafe_code)]
9#![warn(
10    clippy::mod_module_files,
11    clippy::unwrap_used,
12    missing_docs,
13    rust_2018_idioms,
14    unused_qualifications
15)]
16
17//! ## `serde` support
18//!
19//! When the `serde` feature of this crate is enabled, the [`EncodedPoint`]
20//! type receives impls of [`serde::Serialize`] and [`serde::Deserialize`].
21//!
22//! Additionally, when both the `alloc` and `serde` features are enabled, the
23//! serializers/deserializers will autodetect if a "human friendly" textual
24//! encoding is being used, and if so encode the points as hexadecimal.
25
26#[cfg(feature = "alloc")]
27#[allow(unused_extern_crates)]
28extern crate alloc;
29#[cfg(feature = "std")]
30extern crate std;
31
32#[cfg(feature = "point")]
33pub mod point;
34
35mod error;
36#[cfg(feature = "der")]
37mod parameters;
38#[cfg(feature = "der")]
39mod private_key;
40#[cfg(feature = "der")]
41mod traits;
42
43#[cfg(feature = "der")]
44pub use der;
45
46pub use crate::error::{Error, Result};
47
48#[cfg(feature = "point")]
49pub use crate::point::EncodedPoint;
50
51#[cfg(feature = "point")]
52pub use generic_array::typenum::consts;
53
54#[cfg(feature = "der")]
55pub use crate::{parameters::EcParameters, private_key::EcPrivateKey, traits::DecodeEcPrivateKey};
56
57#[cfg(all(feature = "alloc", feature = "der"))]
58pub use crate::traits::EncodeEcPrivateKey;
59
60#[cfg(feature = "pem")]
61pub use der::pem::{self, LineEnding};
62
63#[cfg(feature = "pkcs8")]
64pub use pkcs8;
65
66#[cfg(feature = "pkcs8")]
67use pkcs8::ObjectIdentifier;
68
69#[cfg(all(doc, feature = "serde"))]
70use serdect::serde;
71
72/// Algorithm [`ObjectIdentifier`] for elliptic curve public key cryptography
73/// (`id-ecPublicKey`).
74///
75/// <http://oid-info.com/get/1.2.840.10045.2.1>
76#[cfg(feature = "pkcs8")]
77pub const ALGORITHM_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.10045.2.1");