Skip to main content

pkcs1/
lib.rs

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/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
18#[cfg(feature = "alloc")]
19extern crate alloc;
20#[cfg(feature = "std")]
21extern crate std;
22
23mod error;
24mod params;
25mod private_key;
26mod public_key;
27mod traits;
28mod version;
29
30pub use der::{
31    self,
32    asn1::{ObjectIdentifier, UintRef},
33};
34
35pub use crate::{
36    error::{Error, Result},
37    params::{RsaOaepParams, RsaOaepParamsRef, RsaPssParams, RsaPssParamsRef, TrailerField},
38    private_key::{RsaPrivateKey, RsaPrivateKeyRef},
39    public_key::{RsaPublicKey, RsaPublicKeyRef},
40    traits::{DecodeRsaPrivateKey, DecodeRsaPublicKey},
41    version::Version,
42};
43
44#[cfg(feature = "alloc")]
45pub use crate::{
46    params::{RsaOaepParamsOwned, RsaPssParamsOwned},
47    private_key::{OtherPrimeInfos, RsaPrivateKeyOwned, other_prime_info::OtherPrimeInfo},
48    public_key::RsaPublicKeyOwned,
49    traits::{EncodeRsaPrivateKey, EncodeRsaPublicKey},
50};
51
52#[cfg(feature = "pem")]
53pub use der::pem::{self, LineEnding};
54
55/// `rsaEncryption` Object Identifier (OID)
56pub const ALGORITHM_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.1.1.1");
57
58/// `AlgorithmIdentifier` for RSA.
59pub const ALGORITHM_ID: spki::AlgorithmIdentifierRef<'static> = spki::AlgorithmIdentifierRef {
60    oid: ALGORITHM_OID,
61    parameters: Some(der::asn1::AnyRef::NULL),
62};