File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -119,11 +119,18 @@ impl ObjectIdentifier {
119119
120120 /// Parse an OID from from its BER/DER encoding.
121121 pub fn from_bytes ( ber_bytes : & [ u8 ] ) -> Result < Self > {
122- ObjectIdentifierRef :: from_bytes ( ber_bytes) ? . try_into ( )
122+ Self :: from_bytes_sized ( ber_bytes)
123123 }
124124}
125125
126126impl < const MAX_SIZE : usize > ObjectIdentifier < MAX_SIZE > {
127+ /// Parse an OID from from its BER/DER encoding.
128+ ///
129+ /// Returns `Err(Error::Length)` if bytes do not fit in `MAX_SIZE`.
130+ pub fn from_bytes_sized ( ber_bytes : & [ u8 ] ) -> Result < Self > {
131+ ObjectIdentifierRef :: from_bytes ( ber_bytes) ?. try_into ( )
132+ }
133+
127134 /// Get the BER/DER serialization of this OID as bytes.
128135 ///
129136 /// Note that this encoding omits the ASN.1 tag/length, and only contains the value portion of
You can’t perform that action at this time.
0 commit comments