
This plugin allows you to sign HTML DOM element content with CryptoPro GOST certificates.
Element content will be converted to PDF and signed by selected cretificate.
Plugin uses https://www.npmjs.com/package/crypto-pro-actual-cades-plugin#api-cryptopro lib
This plugin uses the following JavaScript libraries:
Source JavaScript files are located in the js folder. Plugin scripts are built with Vite; the configuration is in vite.config.js. Build scripts are defined in package.json. For development, use npm (e.g. npm run dev, npm run build).
This plugin requires the following software to be installed on the user’s system:
For more information about КриптоПро CSP, please see the product leaflet: https://cryptopro.ru/sites/default/files/products/csp/cryptopro_csp_leaflet_a4.pdf
All rights for КриптоПро CSP and КриптоПро ЭЦП Browser plug-in are reserved by © ООО «КРИПТО-ПРО».
Browsers that do not require additional browser extension configuration after plugin installation:
If you plan to use a different browser, you will need to manually enable the browser extension after completing the plugin installation. Use the instruction corresponding to your browser:
This plugin provides several hooks to extend its functionality.
sdcp_params
Filters the shortcode parameters. You can change the DOM element id to sign
add_filter('sdcp_params', 'change_sdcp_params');
function change_sdcp_params($sdcp_params)
{
// Your code here
return $sdcp_params;
}
sdcp_cert_list_item
Filters the list item of the certificate. You can filter cerst by INN, owner, cn
add_filter('sdcp_cert_list_item', 'change_sdcp_cert_item_li');
function change_sdcp_cert_item_li($item)
{
// Your code here
return 'Signed at: ' . esc_html($item['created_at']) . ' by ' . esc_html($item['owner']);
}
sdcp_saved_sign
This action is triggered after a signature is saved. You can do anything with signed data array
add_action('sdcp_saved_sign', 'sdcp_get_datasignement', 50, 1);
function sdcp_get_datasignement($saved_data)
{
// Your code here
}
You must add yur own script to WordPress at first
function sdcp_hook_javascript_footer() {
?>
<script>
// your javascript code goes here
</script>
<?php
}
add_action('wp_footer', 'sdcp_hook_javascript_footer');
certs
This hook is triggered after the certificates are fetched.
sdcp_ajax_object.callbacks.push({ hook: “certs”, callback: certs });
const certs = (certs) => {
console.log(certs);
return certs;
};
success
This hook is triggered after the form is submitted successfully.
sdcp_ajax_object.callbacks.push({ hook: "success", callback: success });
const success = (successData) => {
console.log(successData);
return successData;
};
error
This hook is triggered if an error occurs during form submission.
sdcp_ajax_object.callbacks.push({ hook: "error", callback: errors });
const errors = (errorData) => {
console.log(errorData);
return errorData;
};
listoptions
This hook is triggered when the certificate options are being rendered.
sdcp_ajax_object.callbacks.push({ hook: "listoptions", callback: listoptions });
const listoptions = (cert) => {
console.log(cert);
return Owner: ${cert.owner}, Expires: ${new Date(
cert.validTo
).toLocaleDateString()}`;
};`
To verify the attached signature, you can use the CryptoPro aplication in your browser, or the Gosuslugi service.
Plugin makes the attached signature and store it in post meta field “sdcp_sign” in “sign” json field.
Plugin give you link to download the signatures as file in [sdcp_show_creation_date] shortcode. Optionaly you can use the “post_id” parameter with this short code. As example,
[sdcp_show_creation_date post_id=2]