Skip to content

Commit 18f277d

Browse files
committed
add CrlReason to asn1-integer conversion
1 parent 8f316a0 commit 18f277d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

openssl/src/x509/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ use std::slice;
2424
use std::str;
2525

2626
use crate::asn1::{
27-
Asn1BitStringRef, Asn1Enumerated, Asn1IntegerRef, Asn1Object, Asn1ObjectRef,
27+
Asn1BitStringRef, Asn1Enumerated, Asn1Integer, Asn1IntegerRef, Asn1Object, Asn1ObjectRef,
2828
Asn1OctetStringRef, Asn1StringRef, Asn1TimeRef, Asn1Type,
2929
};
3030
use crate::bio::MemBioSlice;
31+
use crate::bn::BigNum;
3132
use crate::conf::ConfRef;
3233
use crate::error::ErrorStack;
3334
use crate::ex_data::Index;
@@ -1646,6 +1647,10 @@ impl CrlReason {
16461647
pub const fn as_raw(&self) -> c_int {
16471648
self.0
16481649
}
1650+
1651+
pub fn to_asn1_integer(&self) -> Result<Asn1Integer, ErrorStack> {
1652+
Asn1Integer::from_bn(BigNum::from_u32(self.0 as u32)?.as_ref())
1653+
}
16491654
}
16501655

16511656
/// A builder used to construct `X509Revoked`.

0 commit comments

Comments
 (0)