File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
modules/auxiliary/scanner/ssl Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -631,19 +631,19 @@ def get_factors(data, n)
631
631
def key_from_pqe ( p , q , e )
632
632
# Returns an RSA Private Key from Factors
633
633
key = OpenSSL ::PKey ::RSA . new ( )
634
+ key . set_factors ( p , q )
634
635
635
- key . p = p
636
- key . q = q
636
+ n = key . p * key . q
637
+ phi = ( key . p - 1 ) * ( key . q - 1 )
638
+ d = OpenSSL ::BN . new ( e ) . mod_inverse ( phi )
637
639
638
- key . n = key . p *key . q
639
- key . e = e
640
+ key . set_key ( n , e , d )
640
641
641
- phi = ( key . p - 1 ) * ( key . q - 1 )
642
- key . d = key . e . mod_inverse ( phi )
642
+ dmp1 = key . d % ( key . p - 1 )
643
+ dmq1 = key . d % ( key . q - 1 )
644
+ iqmp = key . q . mod_inverse ( key . p )
643
645
644
- key . dmp1 = key . d % ( key . p - 1 )
645
- key . dmq1 = key . d % ( key . q - 1 )
646
- key . iqmp = key . q . mod_inverse ( key . p )
646
+ key . set_crt_params ( dmp1 , dmq1 , iqmp )
647
647
648
648
return key
649
649
end
You can’t perform that action at this time.
0 commit comments