Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PrecomputedValues public #221

Merged
merged 5 commits into from Nov 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/key.rs
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