class Ronin::Support::Crypto::Key::EC
Represents an EC
key.
## Examples
### List supported curves
Crypto::Key::EC.supported_curves # => ["secp224r1", "secp256k1", "secp384r1", "secp521r1", "prime256v1"]
### Generate a random key
ec = Crypto::Key::EC.random("secp224r1")
@see rubydoc.info/stdlib/openssl/OpenSSL/PKey/EC.html
@since 1.0.0
@api public
Public Class Methods
Source
# File lib/ronin/support/crypto/key/ec.rb, line 69 def self.generate(curve='prime256v1') super(curve) end
Generates a new random EC
key.
@param [String] curve
The curve to use. See {supported_curves}.
@return [EC]
The newly generated key.
Calls superclass method
Source
# File lib/ronin/support/crypto/key/ec.rb, line 85 def initialize(*args) if RUBY_ENGINE == 'jruby' warn "WARNING: jruby-openssl has multiple bugs wrt parsing EC keys" warn " * https://github.com/jruby/jruby-openssl/issues/256" warn " * https://github.com/jruby/jruby-openssl/issues/257" end super(*args) end
Initializes the EC
key.
@param [Array] args
Additional arguments.
@note
Will print a warning message when running on JRuby about jruby-openssl's EC key bugs: * https://github.com/jruby/jruby-openssl/issues/256 *https://github.com/jruby/jruby-openssl/issues/257
Calls superclass method
Source
# File lib/ronin/support/crypto/key/ec.rb, line 56 def self.supported_curves builtin_curves.map { |(name,desc)| name } end
The supported elliptical curves.
@return [Array<String>]
The supported curve names.
Public Instance Methods
Source
# File lib/ronin/support/crypto/key/ec.rb, line 102 def curve group.curve_name end
The Elliptical Curve name.
@return [String]
@since 1.1.0