PHP code example of langleyfoxall / php-rsa-signer

1. Go to this page and download the library: Download langleyfoxall/php-rsa-signer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

langleyfoxall / php-rsa-signer example snippets


$message = 'This is my signable message';

$message = [
    'foo' => 'bar',
    'baz' => 'boff',
];

$message = \stdClass();
$message->foo = 'bar';
$message->baz = 'boff';

// Instantiate with private key

$signer = Signer($privateKey);

// Instantiate with private key, and specific key type

$signer = Signer($xmlPrivateKey, RSA::PRIVATE_FORMAT_XML);


// Get binary signature

$base64Signature = $signer->getSignature($json);

// Get base 64 Signature

$base64Signature = $signer->getBase64Signature($json);

// Get base 64 signature, using custom options for JSON encoding 

$base64Signature = $signer
            ->setJsonEncodingOptions(JSON_UNESCAPED_SLASHES)
            ->getBase64Signature($json);

bash
composer