Class: TCCE::Certificate

Inherits:
Object
  • Object
show all
Defined in:
lib/tcce/certificate.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



6
7
8
# File 'lib/tcce/certificate.rb', line 6

def json
  @json
end

Class Method Details

.parse(content) ⇒ Object

def to_s

JSON.pretty_generate json

end



12
13
14
15
16
# File 'lib/tcce/certificate.rb', line 12

def self.parse(content)
  file = TCCE::Certificate.new
  file.json = content
  file
end

Instance Method Details

#certificateObject



26
27
28
29
# File 'lib/tcce/certificate.rb', line 26

def certificate
  certificate = Base64.decode64 json['Certificate']['Certificate']
  OpenSSL::X509::Certificate.new certificate
end

#domainObject



18
19
20
# File 'lib/tcce/certificate.rb', line 18

def domain
  json['Domains']['Main']
end

#private_keyObject



31
32
33
34
# File 'lib/tcce/certificate.rb', line 31

def private_key
  private_key = Base64.decode64 json['Certificate']['PrivateKey']
  OpenSSL::PKey::RSA.new private_key
end

#sansObject



22
23
24
# File 'lib/tcce/certificate.rb', line 22

def sans
  json['Domains']['SANs']
end