Class: Ccrypto::Java::CrystalDilithiumPrivateKey
- Inherits:
-
PrivateKey
- Object
- PrivateKey
- Ccrypto::Java::CrystalDilithiumPrivateKey
- Defined in:
- lib/ccrypto/java/engines/crystal_dilithium_engine.rb
Overview
class CrystalDilithiumPublicKey
Instance Attribute Summary collapse
-
#param ⇒ Object
readonly
Returns the value of attribute param.
Class Method Summary collapse
Instance Method Summary collapse
- #equals?(privKey) ⇒ Boolean (also: #key_equals?)
-
#initialize(privKey, param) ⇒ CrystalDilithiumPrivateKey
constructor
A new instance of CrystalDilithiumPrivateKey.
- #to_bin ⇒ Object
Constructor Details
#initialize(privKey, param) ⇒ CrystalDilithiumPrivateKey
Returns a new instance of CrystalDilithiumPrivateKey.
75 76 77 78 |
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 75 def initialize(privKey, param) super(privKey) @param = param end |
Instance Attribute Details
#param ⇒ Object (readonly)
Returns the value of attribute param.
74 75 76 |
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 74 def param @param end |
Class Method Details
.to_key(params = {}) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 84 def self.to_key(params = {}) param = params[:param] bcParam = CrystalDilithiumEngine.find_config(param) bcPrivKey = org.bouncycastle.pqc.crypto.crystals.dilithium::DilithiumPrivateKeyParameters.new(bcParam.provider_config[:params], params[:rho].to_java_bytes, params[:k].to_java_bytes, params[:tr].to_java_bytes, params[:s1].to_java_bytes, params[:s2].to_java_bytes, params[:t0].to_java_bytes, params[:t1].to_java_bytes) CrystalDilithiumPrivateKey.new(bcPrivKey, param) end |
Instance Method Details
#equals?(privKey) ⇒ Boolean Also known as: key_equals?
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 91 def equals?(privKey) if not @native_privKey.nil? case privKey when CrystalDilithiumPrivateKey @native_privKey.encoded == privKey.to_bin else logger.warn "Unmatched private key : (native) #{@native_privKey} vs. (subject) #{privKey}" false end else logger.warn "ED25519PrivateKey equals? returned false because native_privKey is nil" false end end |
#to_bin ⇒ Object
80 81 82 |
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 80 def to_bin @native_privKey.encoded end |