1
0
Fork 0

Rename attribute RSAPublicKey#private_key_pem_key to #private_key_pem_secret

This commit is contained in:
Alex Kotov 2019-09-12 06:57:59 +05:00
parent 4990c68fd6
commit 1f9708e7ae
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
7 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
class RSAPublicKey < ApplicationRecord
attr_accessor :private_key_pem_key
attr_accessor :private_key_pem_secret
###############
# Validations #

View file

@ -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

View file

@ -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),