Class: Ccrypto::Java::CrystalDilithiumKeyBundle

Inherits:
Object
  • Object
show all
Includes:
KeyBundle, TR::CondUtils
Defined in:
lib/ccrypto/java/engines/crystal_dilithium_engine.rb

Overview

Crystal-Dilithium mainly for data signing

Instance Method Summary collapse

Constructor Details

#initialize(kp, param) ⇒ CrystalDilithiumKeyBundle

Returns a new instance of CrystalDilithiumKeyBundle.

Raises:

  • (KeypairEngineException)


116
117
118
119
120
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 116

def initialize(kp, param)
  @nativeKeypair = kp
  @param = param
  raise KeypairEngineException, "Given keypair is nil" if @param.nil?
end

Instance Method Details

#is_public_key_equal?(pubKey) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 136

def is_public_key_equal?(pubKey)
  @nativeKeypair.getPublic().encoded == pubKey.encoded
end

#private_keyObject



129
130
131
132
133
134
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 129

def private_key
  if @_privKey.nil?
    @_privKey = CrystalDilithiumPrivateKey.new(@nativeKeypair.getPrivate(), @param.param)
  end
  @_privKey
end

#public_keyObject



122
123
124
125
126
127
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 122

def public_key
  if @_pubKey.nil?
    @_pubKey = CrystalDilithiumPublicKey.new(@nativeKeypair.getPublic(), @param.param)
  end
  @_pubKey
end