Module: EC

Defined in:
lib/elliptic.rb,
lib/elliptic/version.rb

Defined Under Namespace

Classes: Point, PrivateKey, PublicKey, Signature

Constant Summary collapse

GROUP =

“cached” / available groups for now include:

{
  ## todo/check: is there a more direct way to get a group object?
  'secp256k1' =>  OpenSSL::PKey::EC.new( 'secp256k1' ).group
}
MAJOR =
0
MINOR =
2
PATCH =
0
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details



15
16
17
# File 'lib/elliptic/version.rb', line 15

def self.banner
  "elliptic/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
end

.builtin_curvesObject



230
231
232
# File 'lib/elliptic.rb', line 230

def self.builtin_curves
  OpenSSL::PKey::EC.builtin_curves
end

.rootObject



19
20
21
# File 'lib/elliptic/version.rb', line 19

def self.root
  File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
end

.sign(message, priv_key) ⇒ Object



213
214
215
216
# File 'lib/elliptic.rb', line 213

def self.sign( message, priv_key )
  signer = PrivateKey.convert( priv_key )
  signer.sign( message )
end

.verify?(message, signature, pub_key) ⇒ Boolean Also known as: valid_signature?

Returns:

  • (Boolean)


218
219
220
221
# File 'lib/elliptic.rb', line 218

def self.verify?( message, signature, pub_key )
  verifier = PublicKey.convert( pub_key )
  verifier.verify?( message, signature )
end

.versionObject



11
12
13
# File 'lib/elliptic/version.rb', line 11

def self.version
  VERSION
end