Class: RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PublicKey
- Inherits:
-
Object
- Object
- RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PublicKey
- Includes:
- KeyComparator, Serializable
- Defined in:
- lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb
Overview
RbNaCl::Box public key. Send it (securely!) to your friends.
This class stores the NaCL public key, and provides some convenience functions for working with it.
Constant Summary collapse
- BYTES =
The size of the key, in bytes
Boxes::Curve25519XSalsa20Poly1305::PUBLICKEYBYTES
Class Method Summary collapse
-
.primitive ⇒ Symbol
The crypto primitive the PublicKey class is to be used for.
Instance Method Summary collapse
-
#initialize(public_key) ⇒ Object
constructor
Initializes a new PublicKey for key operations.
-
#primitive ⇒ Symbol
The crypto primitive this PublicKey is to be used for.
-
#to_bytes ⇒ String
The raw bytes of the key.
Methods included from Serializable
Methods included from KeyComparator
Constructor Details
#initialize(public_key) ⇒ Object
Initializes a new PublicKey for key operations.
Takes the (optionally encoded) public key bytes. This can be shared with many people and used to establish key pairs with their private key, for the exchanging of messages using a RbNaCl::Box
29 30 31 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 29 def initialize(public_key) @public_key = Util.check_string(public_key, BYTES, "Public key") end |
Class Method Details
.primitive ⇒ Symbol
The crypto primitive the PublicKey class is to be used for
43 44 45 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 43 def self.primitive :curve25519xsalsa20poly1305 end |
Instance Method Details
#primitive ⇒ Symbol
The crypto primitive this PublicKey is to be used for.
50 51 52 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 50 def primitive self.class.primitive end |
#to_bytes ⇒ String
The raw bytes of the key
36 37 38 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 36 def to_bytes @public_key end |