Class: CertificateAuthority::MemoryKeyMaterial

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, KeyMaterial
Defined in:
lib/certificate_authority/key_material.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryKeyMaterial

Returns a new instance of MemoryKeyMaterial.



28
29
# File 'lib/certificate_authority/key_material.rb', line 28

def initialize
end

Instance Attribute Details

#keypairObject

Returns the value of attribute keypair.



24
25
26
# File 'lib/certificate_authority/key_material.rb', line 24

def keypair
  @keypair
end

#private_keyOpenSSL::Pkey::RSA

Returns:

  • (OpenSSL::Pkey::RSA)


58
59
60
# File 'lib/certificate_authority/key_material.rb', line 58

def private_key
  @private_key
end

#public_keyOpenSSL::Pkey::RSA

Returns:

  • (OpenSSL::Pkey::RSA)


63
64
65
# File 'lib/certificate_authority/key_material.rb', line 63

def public_key
  @public_key
end

Instance Method Details

#generate_key(modulus_bits = 2048) ⇒ OpenSSL::Pkey::RSA

Parameters:

  • modulus_bits (Integer) (defaults to: 2048)

    number of bits to generate the key with

Returns:

  • (OpenSSL::Pkey::RSA)


50
51
52
53
54
55
# File 'lib/certificate_authority/key_material.rb', line 50

def generate_key(modulus_bits=2048)
  self.keypair = OpenSSL::PKey::RSA.new(modulus_bits)
  self.private_key = keypair
  self.public_key = keypair.public_key
  self.keypair
end

#is_in_hardware?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/certificate_authority/key_material.rb', line 39

def is_in_hardware?
  false
end

#is_in_memory?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/certificate_authority/key_material.rb', line 44

def is_in_memory?
  true
end