Sha256: d29fa4cca4958683469c7c598a791e7e9231a149bee54b24ec21585aa1f6e4a0

Contents?: true

Size: 368 Bytes

Versions: 3

Compression:

Stored size: 368 Bytes

Contents


module Ccrypto
  module Ruby
    class SecretKeyEngine

      def self.generate(*args, &block)
        config = args.first

        raise SecretKeyEngineException, "KeyConfig is expected" if not config.is_a?(Ccrypto::KeyConfig) 

        key = SecureRandom.random_bytes(config.keysize/8)

        Ccrypto::SecretKey.new(config.algo, key)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ccrypto-ruby-0.1.2 lib/ccrypto/ruby/engines/secret_key_engine.rb
ccrypto-ruby-0.1.1 lib/ccrypto/ruby/engines/secret_key_engine.rb
ccrypto-ruby-0.1.0 lib/ccrypto/ruby/engines/secret_key_engine.rb