Skip to content

Commit 907a76a

Browse files
authored
pkcs8: add PrivateKeyInfo.attributes [0] IMPLICIT reader (#1783)
1 parent 8364eb5 commit 907a76a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkcs8/src/private_key_info.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::fmt;
55
use der::{
66
Decode, DecodeValue, Encode, EncodeValue, FixedTag, Header, Length, Reader, Sequence, TagMode,
77
TagNumber, Writer,
8-
asn1::{AnyRef, BitStringRef, ContextSpecific, OctetStringRef},
8+
asn1::{AnyRef, BitStringRef, ContextSpecific, OctetStringRef, SequenceRef},
99
};
1010
use spki::AlgorithmIdentifier;
1111

@@ -26,6 +26,9 @@ use der::pem::PemLabel;
2626
#[cfg(feature = "subtle")]
2727
use subtle::{Choice, ConstantTimeEq};
2828

29+
/// Context-specific tag number for attributes.
30+
const ATTRIBUTES_TAG: TagNumber = TagNumber(0);
31+
2932
/// Context-specific tag number for the public key.
3033
const PUBLIC_KEY_TAG: TagNumber = TagNumber(1);
3134

@@ -199,6 +202,10 @@ where
199202
let version = Version::decode(reader)?;
200203
let algorithm = reader.decode()?;
201204
let private_key = Key::decode(reader)?;
205+
206+
let _attributes =
207+
reader.context_specific::<SequenceRef<'_>>(ATTRIBUTES_TAG, TagMode::Implicit)?;
208+
202209
let public_key =
203210
reader.context_specific::<PubKey>(PUBLIC_KEY_TAG, TagMode::Implicit)?;
204211

0 commit comments

Comments
 (0)