sec1/
lib.rs

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