php8.5
Home/ Manual/ reference / rnp/ Clearsign text

Clearsign text

This example will clearsign a given text.

Examples

Clearsign text

This example will clearsign a given text.

RNP clearsign example

php
<?php
// init FFI object
$ffi = rnp_ffi_create('GPG', 'GPG');

// generate RSA key
$key = rnp_op_generate_key($ffi, 'test@example.com', 'RSA');

// sign
$data = "Example text to sign";
$signature = rnp_op_sign_cleartext($ffi, $data, array($key));

echo $signature;

// destroy FFI object
rnp_ffi_destroy($ffi);
?>

Source: reference/rnp/examples.xml · from the official PHP manual (php/doc-en)