33件ヒット
[1-33件を表示]
(0.142秒)
キーワード
- RSA (11)
- RandomError (11)
検索結果
-
Random (44001.0)
-
MT19937に基づく擬似乱数生成器を提供するクラスです。
...MT19937に基づく擬似乱数生成器を提供するクラスです。
=== 参考
オリジナル版 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/mt.html... -
OpenSSL
:: Random :: RandomError (18001.0) -
OpenSSL の乱数関連のエラーが起きた場合に発生する例外
OpenSSL の乱数関連のエラーが起きた場合に発生する例外 -
OpenSSL
:: PKey :: RSA (6019.0) -
RSA 暗号鍵のクラスです。
...RSA 暗号鍵のクラスです。
通常このクラスで利用するのは、
OpenSSL::PKey::RSA.generate, OpenSSL::PKey::RSA.new,
OpenSSL::PKey::RSA#public?, OpenSSL::PKey::RSA#private?,
OpenSSL::PKey::RSA#public_key, OpenSSL::PKey::RSA#to_text,
OpenSSL::PKey::RSA#to_pem, OpenSSL::PKey::RSA#to_......RSA についてよく理解し、必要な場合のみにすべきです。
例:
require 'openssl'
# initialize random seed
OpenSSL::Random.seed(File.read("/dev/random", 16))
# 鍵対を生成
rsa = OpenSSL::PKey::RSA.generate(2048)
# 秘密鍵をAES256で暗号化して private_key.......pem に PEM 形式で保存
passphrase = "!secret passphrase!"
File.open("private_key.pem", "w") do |f|
f.write(rsa.export(OpenSSL::Cipher.new("aes256"), passphrase))
end
# 公開鍵をpublic_key.pemに保存
public_key = rsa.public_key
File.open("public_key.pem", "w") do |f|
f....