Class: PQCrypto::KEM::Keypair

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

Direct Known Subclasses

HybridKEM::Keypair

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(public_key, secret_key) ⇒ Keypair

Returns a new instance of Keypair.



142
143
144
145
146
147
148
149
# File 'lib/pq_crypto/kem.rb', line 142

def initialize(public_key, secret_key)
  @public_key = public_key
  @secret_key = secret_key

  unless @public_key.algorithm == @secret_key.algorithm
    raise InvalidKeyError, "KEM keypair algorithms do not match"
  end
end

Instance Attribute Details

#public_keyObject (readonly)

Returns the value of attribute public_key.



140
141
142
# File 'lib/pq_crypto/kem.rb', line 140

def public_key
  @public_key
end

#secret_keyObject (readonly)

Returns the value of attribute secret_key.



140
141
142
# File 'lib/pq_crypto/kem.rb', line 140

def secret_key
  @secret_key
end

Instance Method Details

#algorithmObject



151
152
153
# File 'lib/pq_crypto/kem.rb', line 151

def algorithm
  @public_key.algorithm
end