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 /// Local Android change: Use std to allow building as a dylib. 27 #[cfg(android_dylib)] 28 extern crate std; 29 30 #[cfg(feature = "alloc")] 31 #[allow(unused_extern_crates)] 32 extern crate alloc; 33 #[cfg(feature = "std")] 34 extern crate std; 35 36 #[cfg(feature = "point")] 37 pub mod point; 38 39 mod error; 40 #[cfg(feature = "der")] 41 mod parameters; 42 #[cfg(feature = "der")] 43 mod private_key; 44 #[cfg(feature = "der")] 45 mod traits; 46 47 #[cfg(feature = "der")] 48 pub use der; 49 50 pub use crate::error::{Error, Result}; 51 52 #[cfg(feature = "point")] 53 pub use crate::point::EncodedPoint; 54 55 #[cfg(feature = "point")] 56 pub use generic_array::typenum::consts; 57 58 #[cfg(feature = "der")] 59 pub use crate::{parameters::EcParameters, private_key::EcPrivateKey, traits::DecodeEcPrivateKey}; 60 61 #[cfg(all(feature = "alloc", feature = "der"))] 62 pub use crate::traits::EncodeEcPrivateKey; 63 64 #[cfg(feature = "pem")] 65 pub use der::pem::{self, LineEnding}; 66 67 #[cfg(feature = "pkcs8")] 68 pub use pkcs8; 69 70 #[cfg(feature = "pkcs8")] 71 use pkcs8::ObjectIdentifier; 72 73 #[cfg(all(doc, feature = "serde"))] 74 use serdect::serde; 75 76 /// Algorithm [`ObjectIdentifier`] for elliptic curve public key cryptography 77 /// (`id-ecPublicKey`). 78 /// 79 /// <http://oid-info.com/get/1.2.840.10045.2.1> 80 #[cfg(feature = "pkcs8")] 81 pub const ALGORITHM_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.10045.2.1"); 82