|
| 1 | +//! Encodings of the PKIX AlgorithmIdentifier type. |
| 2 | +//! |
| 3 | +//! This module contains a set of common values, and exists to keep the |
| 4 | +//! names of these separate from the actual algorithm implementations. |
| 5 | +
|
| 6 | +use super::AlgorithmIdentifier; |
| 7 | + |
| 8 | +// See src/data/README.md. |
| 9 | + |
| 10 | +/// AlgorithmIdentifier for `id-ecPublicKey` with named curve `secp256r1`. |
| 11 | +pub const ECDSA_P256: AlgorithmIdentifier = |
| 12 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-p256.der")); |
| 13 | + |
| 14 | +/// AlgorithmIdentifier for `id-ecPublicKey` with named curve `secp384r1`. |
| 15 | +pub const ECDSA_P384: AlgorithmIdentifier = |
| 16 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-p384.der")); |
| 17 | + |
| 18 | +/// AlgorithmIdentifier for `id-ecPublicKey` with named curve `secp521r1`. |
| 19 | +pub const ECDSA_P521: AlgorithmIdentifier = |
| 20 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-p521.der")); |
| 21 | + |
| 22 | +/// AlgorithmIdentifier for `ecdsa-with-SHA256`. |
| 23 | +pub const ECDSA_SHA256: AlgorithmIdentifier = |
| 24 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-sha256.der")); |
| 25 | + |
| 26 | +/// AlgorithmIdentifier for `ecdsa-with-SHA384`. |
| 27 | +pub const ECDSA_SHA384: AlgorithmIdentifier = |
| 28 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-sha384.der")); |
| 29 | + |
| 30 | +/// AlgorithmIdentifier for `ecdsa-with-SHA512`. |
| 31 | +pub const ECDSA_SHA512: AlgorithmIdentifier = |
| 32 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ecdsa-sha512.der")); |
| 33 | + |
| 34 | +/// AlgorithmIdentifier for `rsaEncryption`. |
| 35 | +pub const RSA_ENCRYPTION: AlgorithmIdentifier = |
| 36 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-encryption.der")); |
| 37 | + |
| 38 | +/// AlgorithmIdentifier for `sha256WithRSAEncryption`. |
| 39 | +pub const RSA_PKCS1_SHA256: AlgorithmIdentifier = |
| 40 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pkcs1-sha256.der")); |
| 41 | + |
| 42 | +/// AlgorithmIdentifier for `sha384WithRSAEncryption`. |
| 43 | +pub const RSA_PKCS1_SHA384: AlgorithmIdentifier = |
| 44 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pkcs1-sha384.der")); |
| 45 | + |
| 46 | +/// AlgorithmIdentifier for `sha512WithRSAEncryption`. |
| 47 | +pub const RSA_PKCS1_SHA512: AlgorithmIdentifier = |
| 48 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pkcs1-sha512.der")); |
| 49 | + |
| 50 | +/// AlgorithmIdentifier for `rsassaPss` with: |
| 51 | +/// |
| 52 | +/// - hashAlgorithm: sha256 |
| 53 | +/// - maskGenAlgorithm: mgf1 with sha256 |
| 54 | +/// - saltLength: 32 |
| 55 | +pub const RSA_PSS_SHA256: AlgorithmIdentifier = |
| 56 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pss-sha256.der")); |
| 57 | + |
| 58 | +/// AlgorithmIdentifier for `rsassaPss` with: |
| 59 | +/// |
| 60 | +/// - hashAlgorithm: sha384 |
| 61 | +/// - maskGenAlgorithm: mgf1 with sha384 |
| 62 | +/// - saltLength: 48 |
| 63 | +pub const RSA_PSS_SHA384: AlgorithmIdentifier = |
| 64 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pss-sha384.der")); |
| 65 | + |
| 66 | +/// AlgorithmIdentifier for `rsassaPss` with: |
| 67 | +/// |
| 68 | +/// - hashAlgorithm: sha512 |
| 69 | +/// - maskGenAlgorithm: mgf1 with sha512 |
| 70 | +/// - saltLength: 64 |
| 71 | +pub const RSA_PSS_SHA512: AlgorithmIdentifier = |
| 72 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-rsa-pss-sha512.der")); |
| 73 | + |
| 74 | +/// AlgorithmIdentifier for `ED25519`. |
| 75 | +pub const ED25519: AlgorithmIdentifier = |
| 76 | + AlgorithmIdentifier::from_slice(include_bytes!("data/alg-ed25519.der")); |
0 commit comments