Class: EllipticCurve::PublicKey

Inherits:
Object
  • Object
show all
Defined in:
lib/publickey.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(openSslPublicKey) ⇒ PublicKey

Returns a new instance of PublicKey.



5
6
7
# File 'lib/publickey.rb', line 5

def initialize(openSslPublicKey)
    @openSslPublicKey = openSslPublicKey
end

Instance Attribute Details

#openSslPublicKeyObject (readonly)

Returns the value of attribute openSslPublicKey.



9
10
11
# File 'lib/publickey.rb', line 9

def openSslPublicKey
  @openSslPublicKey
end

Class Method Details

.fromDer(string) ⇒ Object



27
28
29
# File 'lib/publickey.rb', line 27

def self.fromDer(string)
    return PublicKey.new(OpenSSL::PKey::EC.new(string))
end

.fromPem(string) ⇒ Object



23
24
25
# File 'lib/publickey.rb', line 23

def self.fromPem(string)
    return PublicKey.new(OpenSSL::PKey::EC.new(string))
end

.fromString(string) ⇒ Object



31
32
33
# File 'lib/publickey.rb', line 31

def self.fromString(string)
    return PublicKey.new(OpenSSL::PKey::EC.new(Base64.decode64(string)))
end

Instance Method Details

#toDerObject



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

def toDer
    @openSslPublicKey.to_der()
end

#toPemObject



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

def toPem
    @openSslPublicKey.to_pem()
end

#toStringObject



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

def toString
    return Base64.encode64(self.toDer())
end