pub enum KeyIdMethod {
Rfc5280Sha1,
Rfc7093Method1Sha256,
Rfc7093Method2Sha384,
Rfc7093Method3Sha512,
Rfc7093Method4 {
algorithm_oid: Vec<u32>,
},
}Expand description
Method for computing an X.509 key identifier value.
RFC 5280 §4.2.1.2 originally defined a single method (SHA-1 of the
subjectPublicKey BIT STRING value). RFC 7093 adds four supplementary
methods covering stronger hash algorithms and the full
SubjectPublicKeyInfo DER encoding as input:
| Method | Input | Hash | Output |
|---|---|---|---|
| RFC 5280 | BIT STRING value of subjectPublicKey | SHA-1 | full 20 bytes |
| RFC 7093 §2 m1 | BIT STRING value of subjectPublicKey | SHA-256 | leftmost 160 bits (20 bytes) |
| RFC 7093 §2 m2 | BIT STRING value of subjectPublicKey | SHA-384 | leftmost 160 bits (20 bytes) |
| RFC 7093 §2 m3 | BIT STRING value of subjectPublicKey | SHA-512 | leftmost 160 bits (20 bytes) |
| RFC 7093 §2 m4 | Full SubjectPublicKeyInfo DER encoding | configurable | full hash bytes |
Variants§
Rfc5280Sha1
RFC 5280 §4.2.1.2: SHA-1 of the BIT STRING value of subjectPublicKey (full 20 bytes).
Rfc7093Method1Sha256
RFC 7093 §2 method 1: SHA-256 of the BIT STRING value, leftmost 160 bits (20 bytes).
Rfc7093Method2Sha384
RFC 7093 §2 method 2: SHA-384 of the BIT STRING value, leftmost 160 bits (20 bytes).
Rfc7093Method3Sha512
RFC 7093 §2 method 3: SHA-512 of the BIT STRING value, leftmost 160 bits (20 bytes).
Rfc7093Method4
RFC 7093 §2 method 4: hash of the full SubjectPublicKeyInfo DER encoding.
algorithm_oid selects the hash algorithm; the full hash value is used
(no truncation). The RFC recommends SHA-256 as the example algorithm.
Implementations§
Source§impl KeyIdMethod
impl KeyIdMethod
Sourcepub fn algorithm_oid(&self) -> &[u32]
pub fn algorithm_oid(&self) -> &[u32]
OID component array of the hash algorithm used by this method.
Sourcepub fn uses_full_spki_der(&self) -> bool
pub fn uses_full_spki_der(&self) -> bool
Whether this method hashes the full SubjectPublicKeyInfo DER encoding
rather than the BIT STRING value of subjectPublicKey.
Returns true only for Rfc7093Method4.
Trait Implementations§
Source§impl Clone for KeyIdMethod
impl Clone for KeyIdMethod
Source§fn clone(&self) -> KeyIdMethod
fn clone(&self) -> KeyIdMethod
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more