aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / spki / src / 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_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 | #[cfg(feature = "alloc")] |
| 58 | pub use { |
| 59 | crate::{ |
| 60 | algorithm::AlgorithmIdentifierOwned, |
| 61 | spki::SubjectPublicKeyInfoOwned, |
| 62 | traits::{ |
| 63 | DynAssociatedAlgorithmIdentifier, DynSignatureAlgorithmIdentifier, EncodePublicKey, |
| 64 | SignatureBitStringEncoding, |
| 65 | }, |
| 66 | }, |
| 67 | der::Document, |
| 68 | }; |
| 69 | |
| 70 | #[cfg(feature = "fingerprint")] |
| 71 | pub use crate::fingerprint::FingerprintBytes; |