File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -884,6 +884,7 @@ impl<T> PkeyCtxRef<T> {
884
884
#[ cfg( test) ]
885
885
mod test {
886
886
use super :: * ;
887
+ use crate :: bn:: BigNum ;
887
888
#[ cfg( not( any( boringssl, awslc) ) ) ]
888
889
use crate :: cipher:: Cipher ;
889
890
use crate :: ec:: { EcGroup , EcKey } ;
@@ -1055,6 +1056,18 @@ mod test {
1055
1056
assert_eq ! ( params. size( ) , 72 ) ;
1056
1057
}
1057
1058
1059
+ #[ test]
1060
+ fn rsa_keygen ( ) {
1061
+ let pubexp = BigNum :: from_u32 ( 65537 ) . unwrap ( ) ;
1062
+ let mut ctx = PkeyCtx :: new_id ( Id :: RSA ) . unwrap ( ) ;
1063
+ ctx. keygen_init ( ) . unwrap ( ) ;
1064
+ ctx. set_rsa_keygen_pubexp ( & pubexp) . unwrap ( ) ;
1065
+ ctx. set_rsa_keygen_bits ( 2048 ) . unwrap ( ) ;
1066
+ let key = ctx. keygen ( ) . unwrap ( ) ;
1067
+
1068
+ assert_eq ! ( key. bits( ) , 2048 ) ;
1069
+ }
1070
+
1058
1071
#[ test]
1059
1072
#[ cfg( any( ossl110, boringssl, libressl360, awslc) ) ]
1060
1073
fn hkdf ( ) {
You can’t perform that action at this time.
0 commit comments