class RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PublicKey
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.
Constants
- BYTES
The size of the key, in bytes
Public Class Methods
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
@param public_key [String] The public key
@raise [RbNaCl::LengthError] If the key is not valid after decoding.
@return A new PublicKey
# 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
The crypto primitive the PublicKey
class is to be used for
@return [Symbol] The primitive
# File lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb, line 43 def self.primitive :curve25519xsalsa20poly1305 end
Public Instance Methods
The crypto primitive this PublicKey
is to be used for.
@return [Symbol] The primitive
# File lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb, line 50 def primitive self.class.primitive end
The raw bytes of the key
@return [String] the raw bytes.
# File lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb, line 36 def to_bytes @public_key end