interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / spki / src / lib.rs

71 lines · 1993 bytes Raw Blame History
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)]
37extern crate alloc;
38#[cfg(feature = "std")]
39extern crate std;
40
41mod algorithm;
42mod error;
43mod spki;
44mod traits;
45
46#[cfg(feature = "fingerprint")]
47mod fingerprint;
48
49pub use crate::{
50 algorithm::{AlgorithmIdentifier, AlgorithmIdentifierRef, AlgorithmIdentifierWithOid},
51 error::{Error, Result},
52 spki::{SubjectPublicKeyInfo, SubjectPublicKeyInfoRef},
53 traits::{AssociatedAlgorithmIdentifier, DecodePublicKey, SignatureAlgorithmIdentifier},
54};
55pub use der::{self, asn1::ObjectIdentifier};
56
57#[cfg(feature = "alloc")]
58pub 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")]
71pub use crate::fingerprint::FingerprintBytes;