• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![no_std]
2 #![cfg_attr(docsrs, feature(doc_cfg))]
3 #![doc = include_str!("../README.md")]
4 #![doc(
5     html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
6     html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
7 )]
8 #![forbid(unsafe_code, clippy::unwrap_used)]
9 #![warn(missing_docs, rust_2018_idioms, unused_qualifications)]
10 
11 //! ## `serde` support
12 //!
13 //! When the `serde` feature of this crate is enabled, the [`EncodedPoint`]
14 //! type receives impls of [`serde::Serialize`] and [`serde::Deserialize`].
15 //!
16 //! Additionally, when both the `alloc` and `serde` features are enabled, the
17 //! serializers/deserializers will autodetect if a "human friendly" textual
18 //! encoding is being used, and if so encode the points as hexadecimal.
19 
20 /// Local Android change: Use std to allow building as a dylib.
21 #[cfg(android_dylib)]
22 extern crate std;
23 
24 #[cfg(feature = "alloc")]
25 #[allow(unused_extern_crates)]
26 extern crate alloc;
27 #[cfg(feature = "std")]
28 extern crate std;
29 
30 #[cfg(feature = "point")]
31 pub mod point;
32 
33 mod error;
34 #[cfg(feature = "der")]
35 mod parameters;
36 #[cfg(feature = "der")]
37 mod private_key;
38 #[cfg(feature = "der")]
39 mod traits;
40 
41 #[cfg(feature = "der")]
42 pub use der;
43 
44 pub use crate::error::{Error, Result};
45 
46 #[cfg(feature = "point")]
47 pub use crate::point::EncodedPoint;
48 
49 #[cfg(feature = "point")]
50 pub use generic_array::typenum::consts;
51 
52 #[cfg(feature = "der")]
53 pub use crate::{parameters::EcParameters, private_key::EcPrivateKey, traits::DecodeEcPrivateKey};
54 
55 #[cfg(feature = "alloc")]
56 pub use crate::traits::EncodeEcPrivateKey;
57 
58 #[cfg(feature = "pem")]
59 #[cfg_attr(docsrs, doc(cfg(feature = "pem")))]
60 pub use der::pem::{self, LineEnding};
61 
62 #[cfg(feature = "pkcs8")]
63 #[cfg_attr(docsrs, doc(cfg(feature = "pkcs8")))]
64 pub use pkcs8;
65 
66 #[cfg(feature = "pkcs8")]
67 use pkcs8::ObjectIdentifier;
68 
69 #[cfg(all(doc, feature = "serde"))]
70 use 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")]
77 #[cfg_attr(docsrs, doc(cfg(feature = "pkcs8")))]
78 pub const ALGORITHM_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.10045.2.1");
79