2件ヒット
[1-2件を表示]
(0.010秒)
別のキーワード
種類
- インスタンスメソッド (1)
- クラス (1)
クラス
検索結果
-
OpenSSL
:: PKey :: RSA (54343.0) -
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_der
のいずれかでしょう。......ついてよく理解し、必要な場合のみにすべきです。
例:
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.write(pu... -
OpenSSL
:: SSL :: SSLContext # ciphers -> [[String , String , Integer , Integer]] (61.0) -
利用可能な共通鍵暗号の種類を配列で返します。
...の文字列, 利用可能なSSL/TLSのバージョン文字列, 鍵長(ビット数), アルゴリズムのビット長]
例:
require 'openssl'
ctx = OpenSSL::SSL::SSLContext.new('TLSv1')
ctx.ciphers
# => [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256],
# ["DHE-DSS-AES256-SHA", "TLS...