Modulus and Exponent

S

Shandy Nantz

Is there a way to get the modulus and exponent from an key, or is there
a way to get that information as it is being encrypted? I am using the
OpenSSL::pKey::RSA library to encrypt my data. Thanks,

-S
 
A

Adam Bozanich

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

Is there a way to get the modulus and exponent from an key, or is there
a way to get that information as it is being encrypted? I am using the
OpenSSL::pKey::RSA library to encrypt my data. Thanks,

It's in ext/openssl/ossl_pkey_rsa.c:eek:ssl_rsa_get_params

sh-2.05b$ openssl genrsa -out test.pem 512
Generating RSA private key, 512 bit long modulus
......++++++++++++
++++++++++++
e is 65537 (0x10001)
sh-2.05b$ cat sslparams.rb
require 'openssl'
file = ARGV[0] || "test.pem"
OpenSSL::pKey::RSA.new(File.read(file)).params.each do |k,v|
puts "#{k} = #{v}"
end
sh-2.05b$ ruby sslparams.rb
iqmp =
59260111929228437887497692691757636132892230319984822766526877098035186370601
n =
11804463841624570992464253395735827528891316877747581110813958174030871384082650715713947258948719543061592249783350178655531273368202635182086293357491941
d =
11689187633396551317545091362483299497115519346555148562621014749226871236290914623323220129606434399743927309247086015156374960675693636631059313239642145
p =
112801836523523861906861645509931518041464374339361561066100421492644618944537
e = 65537
q =
104647798346464426891710400199240987063553868486458584292121861850498642450093
dmq1 =
99023959205578397450133824684619830214173568429859912795458096383091586608213
dmp1 =
53486077635053542407429782172225184600126728910320284879214346062284381856073

-Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top