1 | use super::PublicKeyComponents; |
2 | |
3 | /// RSA key pair components. |
4 | #[derive (Clone, Copy)] |
5 | pub struct KeyPairComponents<Public, Private = Public> { |
6 | /// The public key components. |
7 | pub public_key: PublicKeyComponents<Public>, |
8 | |
9 | /// The private exponent. |
10 | pub d: Private, |
11 | |
12 | /// The first prime factor of `d`. |
13 | pub p: Private, |
14 | |
15 | /// The second prime factor of `d`. |
16 | pub q: Private, |
17 | |
18 | /// `p`'s public Chinese Remainder Theorem exponent. |
19 | pub dP: Private, |
20 | |
21 | /// `q`'s public Chinese Remainder Theorem exponent. |
22 | pub dQ: Private, |
23 | |
24 | /// `q**-1 mod p`. |
25 | pub qInv: Private, |
26 | } |
27 | |
28 | impl<Public, Private> core::fmt::Debug for KeyPairComponents<Public, Private> |
29 | where |
30 | PublicKeyComponents<Public>: core::fmt::Debug, |
31 | { |
32 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> { |
33 | // Non-public components are intentionally skipped |
34 | f&mut DebugStruct<'_, '_>.debug_struct("KeyPairComponents" ) |
35 | .field(name:"public_key" , &self.public_key) |
36 | .finish() |
37 | } |
38 | } |
39 | |