Class: Pkernel::Identity

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

Overview

Identity Identity is abstraction consist of keypair + certificate, stored separately

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Identity

Returns a new instance of Identity.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/pkernel.rb', line 142

def initialize(opts)
  if self.respond_to?(:pre_init)
    pre_init(opts)
  end
  @key = opts[:key]
  @pubKey = opts[:pubKey]
  @privKey = opts[:privKey]
  @certificate = opts[:certificate]
  @keystore = opts[:keystore]
  @chain = opts[:chain]
  if self.respond_to?(:post_init)
    post_init(opts)
  end
end

Instance Attribute Details

#certificateObject (readonly)

Returns the value of attribute certificate.



141
142
143
# File 'lib/pkernel.rb', line 141

def certificate
  @certificate
end

#chainObject (readonly)

Returns the value of attribute chain.



141
142
143
# File 'lib/pkernel.rb', line 141

def chain
  @chain
end

#keyObject (readonly)

Returns the value of attribute key.



141
142
143
# File 'lib/pkernel.rb', line 141

def key
  @key
end

#keystoreObject (readonly)

Returns the value of attribute keystore.



141
142
143
# File 'lib/pkernel.rb', line 141

def keystore
  @keystore
end

#privKeyObject (readonly)

Returns the value of attribute privKey.



141
142
143
# File 'lib/pkernel.rb', line 141

def privKey
  @privKey
end

#pubKeyObject (readonly)

Returns the value of attribute pubKey.



141
142
143
# File 'lib/pkernel.rb', line 141

def pubKey
  @pubKey
end

Instance Method Details

#to_sObject



157
158
159
160
161
162
163
# File 'lib/pkernel.rb', line 157

def to_s
  res = []
  res << "Identity:"
  res << "Keypair : #{@key.nil? ? 'Not exist' : 'Exist'}"
  res << "Cert : #{@certificate.nil? ? 'Not exist' : 'Exist'}"
  res.join("\n")
end