Class: Ccrypto::Java::CrystalDilithiumPublicKey
- Inherits:
-
PublicKey
- Object
- PublicKey
- Ccrypto::Java::CrystalDilithiumPublicKey
show all
- Includes:
- DataConversion, TR::CondUtils
- Defined in:
- lib/ccrypto/java/engines/crystal_dilithium_engine.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#from_b64, #from_b64_mime, #from_hex, included, #logger, #to_b64, #to_b64_mime, #to_hex, #to_java_bytes, #to_str
Constructor Details
Returns a new instance of CrystalDilithiumPublicKey.
20
21
22
23
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 20
def initialize(pubKey, param)
super(pubKey)
@param = param
end
|
Instance Attribute Details
#param ⇒ Object
Returns the value of attribute param.
19
20
21
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 19
def param
@param
end
|
Class Method Details
.to_key(params, bin) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 33
def self.to_key(params, bin)
bin = to_java_bytes(bin) if not bin.is_a?(::Java::byte[])
case params
when Ccrypto::CrystalDilithiumConfig
pa = params.provider_config[:params]
when Symbol
pa = CrystalDilithiumEngine.supported_configs[params]
if not_empty?(pa)
pa = pa.provider_config[:params]
end
else
raise CrystalDilithiumEngineError, "Unsupported params type '#{params.class}'"
end
raise CrystalDilithiumEngineError, "Unknown param '#{param}'" if is_empty?(pa)
pubKey = DilithiumPublicKeyParameters.new(pa, bin)
CrystalDilithiumPublicKey.new(pubKey, pa)
end
|
Instance Method Details
#encoded ⇒ Object
29
30
31
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 29
def encoded
to_bin
end
|
#equals?(pubKey) ⇒ Boolean
Also known as:
key_equals?
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 54
def equals?(pubKey)
if not @native_pubKey.nil?
case pubKey
when CrystalDilithiumPublicKey
@native_pubKey.encoded == pubKey.to_bin
else
logger.warn "Unmatched public key : (native) #{@native_pubKey} vs. (subject) #{pubKey}"
false
end
else
logger.warn "CrystalDilithiumPublicKey equals? returned false because native_pubKey is nil"
false
end
end
|
#to_bin ⇒ Object
25
26
27
|
# File 'lib/ccrypto/java/engines/crystal_dilithium_engine.rb', line 25
def to_bin
@native_pubKey.encoded
end
|