Skip to content

Commit

Permalink
Add public accessor methods for PrecomputedValues (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson authored Nov 11, 2022
1 parent 4f1d413 commit b06a5ce
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,21 @@ impl RsaPrivateKey {
self.precomputed = None;
}

/// Returns the precomputed dp value, D mod (P-1)
pub fn dp(&self) -> Option<&BigUint> {
self.precomputed.as_ref().map(|p| &p.dp)
}

/// Returns the precomputed dq value, D mod (Q-1)
pub fn dq(&self) -> Option<&BigUint> {
self.precomputed.as_ref().map(|p| &p.dq)
}

/// Returns the precomputed qinv value, Q^-1 mod P
pub fn qinv(&self) -> Option<&BigInt> {
self.precomputed.as_ref().map(|p| &p.qinv)
}

/// Returns the private exponent of the key.
pub fn d(&self) -> &BigUint {
&self.d
Expand Down

0 comments on commit b06a5ce

Please sign in to comment.