pkcs1/private_key/
other_prime_info.rs1use der::{asn1::UIntRef, DecodeValue, Encode, Header, Reader, Sequence};
4
5#[derive(Clone)]
19#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
20pub struct OtherPrimeInfo<'a> {
21 pub prime: UIntRef<'a>,
23
24 pub exponent: UIntRef<'a>,
26
27 pub coefficient: UIntRef<'a>,
29}
30
31impl<'a> DecodeValue<'a> for OtherPrimeInfo<'a> {
32 fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> der::Result<Self> {
33 reader.read_nested(header.length, |reader| {
34 Ok(Self {
35 prime: reader.decode()?,
36 exponent: reader.decode()?,
37 coefficient: reader.decode()?,
38 })
39 })
40 }
41}
42
43impl<'a> Sequence<'a> for OtherPrimeInfo<'a> {
44 fn fields<F, T>(&self, f: F) -> der::Result<T>
45 where
46 F: FnOnce(&[&dyn Encode]) -> der::Result<T>,
47 {
48 f(&[&self.prime, &self.exponent, &self.coefficient])
49 }
50}