Module: EC

Defined in:
lib/elliptic.rb,
lib/elliptic/version.rb,
lib/elliptic/signature.rb,
lib/elliptic/public_key.rb,
lib/elliptic/private_key.rb

Defined Under Namespace

Classes: Point, PrivateKey, PublicKey, Signature

Constant Summary collapse

SECP256K1 =
Secp256k1 = OpenSSL::PKey::EC::Group.new( 'secp256k1' )
GROUP =

“cached” / available groups for now include:

todo/check: change group to curve - why? why not?
{
  'secp256k1' => SECP256K1,
}
MAJOR =
1
MINOR =
0
PATCH =
2
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



100
101
102
# File 'lib/elliptic.rb', line 100

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



83
84
85
86
# File 'lib/elliptic.rb', line 83

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)


88
89
90
91
# File 'lib/elliptic.rb', line 88

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