Rename attribute RSAPublicKey#private_key_pem_key to #private_key_pem_secret
This commit is contained in:
parent
4990c68fd6
commit
1f9708e7ae
7 changed files with 8 additions and 8 deletions
|
@ -30,7 +30,7 @@ private
|
|||
end
|
||||
|
||||
def set_secret
|
||||
@rsa_public_key.private_key_pem_key =
|
||||
@rsa_public_key.private_key_pem_secret =
|
||||
Base64.urlsafe_decode64 params[:private_key_secret]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ class Staffs::X509CertificatesController < ApplicationController
|
|||
redirect_to staff_x509_certificate_url(
|
||||
result.certificate,
|
||||
private_key_secret: Base64.urlsafe_encode64(
|
||||
result.public_key.private_key_pem_key,
|
||||
result.public_key.private_key_pem_secret,
|
||||
),
|
||||
)
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ class CreateRSAKeys
|
|||
bits: BITS,
|
||||
public_key_pem: @pkey.public_key.to_pem.freeze,
|
||||
private_key_pem_iv: @iv,
|
||||
private_key_pem_key: @key,
|
||||
private_key_pem_secret: @key,
|
||||
private_key_pem_ciphertext: @ciphertext,
|
||||
)
|
||||
end
|
||||
|
|
|
@ -19,6 +19,6 @@ private
|
|||
@cipher.decrypt
|
||||
|
||||
@cipher.iv = context.public_key.private_key_pem_iv
|
||||
@cipher.key = context.public_key.private_key_pem_key
|
||||
@cipher.key = context.public_key.private_key_pem_secret
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RSAPublicKey < ApplicationRecord
|
||||
attr_accessor :private_key_pem_key
|
||||
attr_accessor :private_key_pem_secret
|
||||
|
||||
###############
|
||||
# Validations #
|
||||
|
|
|
@ -40,6 +40,6 @@ RSpec.describe CreateRSAKeysAndX509SelfSignedCertificate do
|
|||
end
|
||||
|
||||
specify do
|
||||
expect(subject.public_key.private_key_pem_key).not_to be_blank
|
||||
expect(subject.public_key.private_key_pem_secret).not_to be_blank
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ RSpec.describe CreateRSAKeys do
|
|||
end
|
||||
|
||||
specify do
|
||||
expect(subject.public_key.private_key_pem_key).not_to be_blank
|
||||
expect(subject.public_key.private_key_pem_secret).not_to be_blank
|
||||
end
|
||||
|
||||
specify do
|
||||
|
@ -55,7 +55,7 @@ RSpec.describe CreateRSAKeys do
|
|||
cipher = OpenSSL::Cipher::AES256.new
|
||||
cipher.decrypt
|
||||
cipher.iv = subject.public_key.private_key_pem_iv
|
||||
cipher.key = subject.public_key.private_key_pem_key
|
||||
cipher.key = subject.public_key.private_key_pem_secret
|
||||
|
||||
cleartext = [
|
||||
cipher.update(subject.public_key.private_key_pem_ciphertext),
|
||||
|
|
Reference in a new issue