Class: Sandal::Enc::Alg::RSA1_5
- Inherits:
-
Object
- Object
- Sandal::Enc::Alg::RSA1_5
- Defined in:
- lib/sandal/enc/alg/rsa1_5.rb
Overview
The RSAES-PKCS1-V1_5 key encryption mechanism.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The JWA name of the algorithm.
Instance Method Summary collapse
-
#decrypt_cmk(encrypted_cmk) ⇒ String
Decrypts the content master key.
-
#encrypt_cmk(cmk) ⇒ String
Encrypts the content master key.
-
#initialize(key) ⇒ RSA1_5
constructor
Creates a new instance.
Constructor Details
#initialize(key) ⇒ RSA1_5
Creates a new instance.
16 17 18 19 |
# File 'lib/sandal/enc/alg/rsa1_5.rb', line 16 def initialize(key) @name = 'RSA1_5' @key = key end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns The JWA name of the algorithm.
11 12 13 |
# File 'lib/sandal/enc/alg/rsa1_5.rb', line 11 def name @name end |
Instance Method Details
#decrypt_cmk(encrypted_cmk) ⇒ String
Decrypts the content master key.
34 35 36 37 38 |
# File 'lib/sandal/enc/alg/rsa1_5.rb', line 34 def decrypt_cmk(encrypted_cmk) @key.private_decrypt(encrypted_cmk) rescue raise Sandal::TokenError, 'Failed to decrypt the content master key.' end |
#encrypt_cmk(cmk) ⇒ String
Encrypts the content master key.
25 26 27 |
# File 'lib/sandal/enc/alg/rsa1_5.rb', line 25 def encrypt_cmk(cmk) @key.public_encrypt(cmk) end |