Skip to content

Commit d174a0a

Browse files
committed
pkey_ctx: add rsa key generation test
1 parent 2573ffa commit d174a0a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

openssl/src/pkey_ctx.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ impl<T> PkeyCtxRef<T> {
818818
#[cfg(test)]
819819
mod test {
820820
use super::*;
821+
use crate::bn::BigNum;
821822
#[cfg(not(any(boringssl, awslc)))]
822823
use crate::cipher::Cipher;
823824
use crate::ec::{EcGroup, EcKey};
@@ -953,6 +954,16 @@ mod test {
953954
ctx.keygen().unwrap();
954955
}
955956

957+
#[test]
958+
fn rsa_generate() {
959+
let pubexp = BigNum::from_u32(65537).unwrap();
960+
let mut ctx = PkeyCtx::new_id(Id::RSA).unwrap();
961+
ctx.keygen_init().unwrap();
962+
ctx.set_rsa_keygen_pubexp(&pubexp).unwrap();
963+
ctx.set_rsa_keygen_bits(2048).unwrap();
964+
ctx.keygen().unwrap();
965+
}
966+
956967
#[test]
957968
#[cfg(any(ossl110, boringssl, libressl360, awslc))]
958969
fn hkdf() {

0 commit comments

Comments
 (0)