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
|
end
|
||||||
|
|
||||||
def set_secret
|
def set_secret
|
||||||
@rsa_public_key.private_key_pem_key =
|
@rsa_public_key.private_key_pem_secret =
|
||||||
Base64.urlsafe_decode64 params[:private_key_secret]
|
Base64.urlsafe_decode64 params[:private_key_secret]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Staffs::X509CertificatesController < ApplicationController
|
||||||
redirect_to staff_x509_certificate_url(
|
redirect_to staff_x509_certificate_url(
|
||||||
result.certificate,
|
result.certificate,
|
||||||
private_key_secret: Base64.urlsafe_encode64(
|
private_key_secret: Base64.urlsafe_encode64(
|
||||||
result.public_key.private_key_pem_key,
|
result.public_key.private_key_pem_secret,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CreateRSAKeys
|
||||||
bits: BITS,
|
bits: BITS,
|
||||||
public_key_pem: @pkey.public_key.to_pem.freeze,
|
public_key_pem: @pkey.public_key.to_pem.freeze,
|
||||||
private_key_pem_iv: @iv,
|
private_key_pem_iv: @iv,
|
||||||
private_key_pem_key: @key,
|
private_key_pem_secret: @key,
|
||||||
private_key_pem_ciphertext: @ciphertext,
|
private_key_pem_ciphertext: @ciphertext,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,6 @@ private
|
||||||
@cipher.decrypt
|
@cipher.decrypt
|
||||||
|
|
||||||
@cipher.iv = context.public_key.private_key_pem_iv
|
@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
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RSAPublicKey < ApplicationRecord
|
class RSAPublicKey < ApplicationRecord
|
||||||
attr_accessor :private_key_pem_key
|
attr_accessor :private_key_pem_secret
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Validations #
|
# Validations #
|
||||||
|
|
|
@ -40,6 +40,6 @@ RSpec.describe CreateRSAKeysAndX509SelfSignedCertificate do
|
||||||
end
|
end
|
||||||
|
|
||||||
specify do
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@ RSpec.describe CreateRSAKeys do
|
||||||
end
|
end
|
||||||
|
|
||||||
specify do
|
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
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
|
@ -55,7 +55,7 @@ RSpec.describe CreateRSAKeys do
|
||||||
cipher = OpenSSL::Cipher::AES256.new
|
cipher = OpenSSL::Cipher::AES256.new
|
||||||
cipher.decrypt
|
cipher.decrypt
|
||||||
cipher.iv = subject.public_key.private_key_pem_iv
|
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 = [
|
cleartext = [
|
||||||
cipher.update(subject.public_key.private_key_pem_ciphertext),
|
cipher.update(subject.public_key.private_key_pem_ciphertext),
|
||||||
|
|
Reference in a new issue