るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.012秒)

別のキーワード

  1. aes new
  2. aes256 new
  3. aes192 new
  4. aes128 new
  5. openssl aes

検索結果

OpenSSL::PKey::RSA (18114.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で暗号化し...
...|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(public_key.export)
end

# 秘密鍵で署名
data = "foobar"
sign = rsa.sign("sha256", d...

OpenSSL::SSL::SSLContext#ciphers -> [[String, String, Integer, Integer]] (20.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", "TLSv1/SSLv3", 256, 256], ... ]...