You are here

public static function ParagonIE_Sodium_Core_Ed25519::sign_open in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core/Ed25519.php \ParagonIE_Sodium_Core_Ed25519::sign_open()

@internal You should not use this directly from another application

Parameters

string $message A signed message:

string $pk Public key:

Return value

string Message (without signature)

Throws

SodiumException

TypeError

1 call to ParagonIE_Sodium_Core_Ed25519::sign_open()
ParagonIE_Sodium_Crypto::sign_open in vendor/paragonie/sodium_compat/src/Crypto.php
Opens a signed message. If valid, returns the message.

File

vendor/paragonie/sodium_compat/src/Core/Ed25519.php, line 186

Class

ParagonIE_Sodium_Core_Ed25519
Class ParagonIE_Sodium_Core_Ed25519

Code

public static function sign_open($message, $pk) {

  /** @var string $signature */
  $signature = self::substr($message, 0, 64);

  /** @var string $message */
  $message = self::substr($message, 64);
  if (self::verify_detached($signature, $message, $pk)) {
    return $message;
  }
  throw new SodiumException('Invalid signature');
}