sign() public static method

Specifically: 1. Calculate the BLAKE2b-512 checksum of the file, with the signer's Ed25519 public key used as a BLAKE2b key. 2. Sign the checksum with Ed25519, using the corresponding public key.
public static sign ( string | resource $filename, SignatureSecretKey $secretKey, boolean $raw_binary = false ) : string
$filename string | resource File name or file handle
$secretKey SignatureSecretKey Secret key for digital signatures
$raw_binary boolean Default: return hexadecimal
return string Detached signature for the file
Example #1
0
 public function testSign()
 {
     $keypair = KeyFactory::generateSignatureKeyPair();
     $secretkey = $keypair->getSecretKey();
     $publickey = $keypair->getPublicKey();
     $signature = File::sign(__DIR__ . '/tmp/paragon_avatar.png', $secretkey);
     $this->assertTrue(!empty($signature));
     $this->assertTrue(File::verify(__DIR__ . '/tmp/paragon_avatar.png', $publickey, $signature));
 }