@@ -25,6 +25,7 @@ impl signature::VerificationAlgorithm for RSAParameters {
25
25
fn verify ( & self , public_key : untrusted:: Input , msg : untrusted:: Input ,
26
26
signature : untrusted:: Input )
27
27
-> Result < ( ) , error:: Unspecified > {
28
+ let public_key = try!( parse_public_key ( public_key) ) ;
28
29
verify_rsa ( self , public_key, msg, signature)
29
30
}
30
31
}
@@ -61,15 +62,17 @@ rsa_pkcs1!(RSA_PKCS1_3072_8192_SHA384, 3072, &super::RSA_PKCS1_SHA384,
61
62
"Verification of signatures using RSA keys of 3072-8192 bits,
62
63
PKCS#1.5 padding, and SHA-384." ) ;
63
64
64
- fn verify_rsa ( params : & RSAParameters , public_key : untrusted:: Input ,
65
+ fn verify_rsa ( params : & RSAParameters ,
66
+ ( n, e) : ( untrusted:: Input , untrusted:: Input ) ,
65
67
msg : untrusted:: Input , signature : untrusted:: Input )
66
68
-> Result < ( ) , error:: Unspecified > {
67
69
const MAX_BITS : usize = 8192 ;
68
70
69
- let ( n, e) = try!( parse_public_key ( public_key) ) ;
70
71
let signature = signature. as_slice_less_safe ( ) ;
71
72
72
73
let mut decoded = [ 0u8 ; ( MAX_BITS + 7 ) / 8 ] ;
74
+ let n = n. as_slice_less_safe ( ) ;
75
+ let e = e. as_slice_less_safe ( ) ;
73
76
if signature. len ( ) > decoded. len ( ) {
74
77
return Err ( error:: Unspecified ) ;
75
78
}
0 commit comments