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_lifetimes, 15 unused_qualifications 16 )] 17 //! # Usage 18 //! The following example demonstrates how to use an OID as the `parameters` 19 //! of an [`AlgorithmIdentifier`]. 20 //! 21 //! Borrow the [`ObjectIdentifier`] first then use [`der::AnyRef::from`] or `.into()`: 22 //! 23 //! ``` 24 //! use spki::{AlgorithmIdentifier, ObjectIdentifier}; 25 //! 26 //! let alg_oid = "1.2.840.10045.2.1".parse::<ObjectIdentifier>().unwrap(); 27 //! let params_oid = "1.2.840.10045.3.1.7".parse::<ObjectIdentifier>().unwrap(); 28 //! 29 //! let alg_id = AlgorithmIdentifier { 30 //! oid: alg_oid, 31 //! parameters: Some(params_oid) 32 //! }; 33 //! ``` 34 35 #[cfg(feature = "alloc")] 36 #[allow(unused_extern_crates)] 37 extern crate alloc; 38 #[cfg(feature = "std")] 39 extern crate std; 40 41 mod algorithm; 42 mod error; 43 mod spki; 44 mod traits; 45 46 #[cfg(feature = "fingerprint")] 47 mod fingerprint; 48 49 pub use crate::{ 50 algorithm::{AlgorithmIdentifier, AlgorithmIdentifierRef, AlgorithmIdentifierWithOid}, 51 error::{Error, Result}, 52 spki::{SubjectPublicKeyInfo, SubjectPublicKeyInfoRef}, 53 traits::{AssociatedAlgorithmIdentifier, DecodePublicKey, SignatureAlgorithmIdentifier}, 54 }; 55 pub use der::{self, asn1::ObjectIdentifier}; 56 57 /// Local Android change: Use std to allow building as a dylib. 58 #[cfg(android_dylib)] 59 extern crate std; 60 61 #[cfg(feature = "alloc")] 62 pub use { 63 crate::{ 64 algorithm::AlgorithmIdentifierOwned, 65 spki::SubjectPublicKeyInfoOwned, 66 traits::{ 67 DynAssociatedAlgorithmIdentifier, DynSignatureAlgorithmIdentifier, EncodePublicKey, 68 SignatureBitStringEncoding, 69 }, 70 }, 71 der::Document, 72 }; 73 74 #[cfg(feature = "fingerprint")] 75 pub use crate::fingerprint::FingerprintBytes; 76