BoxTrait trait

Framework\Crypto\BoxTrait

Trait BoxTrait.

Defined in libraries/crypto/src/BoxTrait.php

Methods #

makeKeyPair()
Makes a keypair.
makeNonce()
Makes a box nonce with the correct length.
makePublicKey()
Makes the public key from a keypair.
makeSecretKey()
Makes the secret key from a keypair.

makeKeyPair()

public static function makeKeyPair(): string

Makes a keypair.

Returns string
throws
SodiumException

makeNonce()

public static function makeNonce(): string

Makes a box nonce with the correct length.

Returns string
throws
Exception if fail to get random bytes

makePublicKey()

public static function makePublicKey(string $keyPair): string

Makes the public key from a keypair.

Parameters
  • string $keyPair
Returns string
throws
SodiumException

makeSecretKey()

public static function makeSecretKey(string $keyPair): string

Makes the secret key from a keypair.

Parameters
  • string $keyPair
Returns string
throws
SodiumException