Class: Ccrypto::Java::X25519Engine

Inherits:
Object
  • Object
show all
Includes:
DataConversion, TR::CondUtils, TeLogger::TeLogHelper
Defined in:
lib/ccrypto/java/engines/x25519_engine.rb

Overview

X25519KeyBundle

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DataConversion

#from_b64, #from_b64_mime, #from_hex, included, #logger, #to_b64, #to_b64_mime, #to_bin, #to_hex, #to_java_bytes, #to_str

Constructor Details

#initialize(*args, &block) ⇒ X25519Engine

Returns a new instance of X25519Engine.



232
233
234
# File 'lib/ccrypto/java/engines/x25519_engine.rb', line 232

def initialize(*args, &block)
  @config = args.first
end

Class Method Details

.supported_paramsObject



228
229
230
# File 'lib/ccrypto/java/engines/x25519_engine.rb', line 228

def self.supported_params
  []
end

Instance Method Details

#generate_keypair(&block) ⇒ Object



236
237
238
239
240
241
242
243
# File 'lib/ccrypto/java/engines/x25519_engine.rb', line 236

def generate_keypair(&block)
 
  JCEProvider.instance.add_bc_provider
  kg = java.security.KeyPairGenerator.getInstance("X25519", JCEProvider::BCProv.name)
  kg.java_send(:initialize, [java.security.spec.AlgorithmParameterSpec], org.bouncycastle.jcajce.spec.XDHParameterSpec.new(org.bouncycastle.jcajce.spec.XDHParameterSpec::X25519))
  X25519KeyBundle.new(kg.generateKeyPair)

end