Class: CARPS::PublicKey
- Defined in:
- lib/carps/crypt/public_key.rb
Overview
Transmit public keys over email
Class Method Summary collapse
-
.parse(blob) ⇒ Object
Parse from text.
Instance Method Summary collapse
-
#emit ⇒ Object
Emit the handshake as text.
-
#initialize(public_key) ⇒ PublicKey
constructor
Create a new handshake.
-
#key ⇒ Object
Share the public key.
Methods inherited from Message
#crypt, #crypt=, #delete, #from, #from=, #parse, #path=, #save, #session, #session=
Constructor Details
#initialize(public_key) ⇒ PublicKey
Create a new handshake
32 33 34 |
# File 'lib/carps/crypt/public_key.rb', line 32 def initialize public_key @public_key = public_key end |
Class Method Details
.parse(blob) ⇒ Object
Parse from text
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/carps/crypt/public_key.rb', line 37 def PublicKey.parse blob key, blob = find K.key, blob pkey = OpenSSL::PKey begin key = pkey::DSA.new key return [PublicKey.new(key), blob] rescue pkey::DSAError raise Expected, "Public key" end end |
Instance Method Details
#emit ⇒ Object
Emit the handshake as text
49 50 51 |
# File 'lib/carps/crypt/public_key.rb', line 49 def emit V.key @public_key.to_pem end |
#key ⇒ Object
Share the public key
54 55 56 |
# File 'lib/carps/crypt/public_key.rb', line 54 def key @public_key end |