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
27 28 29 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 27 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
41 42 43 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 41 def self.primitive :curve25519xsalsa20poly1305 end |
Instance Method Details
#primitive ⇒ Symbol
The crypto primitive this PublicKey is to be used for.
48 49 50 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 48 def primitive self.class.primitive end |
#to_bytes ⇒ String
The raw bytes of the key
34 35 36 |
# File 'lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb', line 34 def to_bytes @public_key end |