るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.015秒)
トップページ > ライブラリ:openssl[x] > クエリ:AES[x] > クエリ:RSA[x] > 種類:クラス[x]

別のキーワード

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

検索結果

OpenSSL::PKey::RSA (18115.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...