echo $pflog; echo "\r\n"; if (function_exists('gostSignBlock')) { $fn = '1M'; $cn = 'user'; $content = file_get_contents($fn . '.dat'); $b64content = base64_encode($content); if ($resOneSign = gostSignBlock($b64content, 'Максимов Сергей Вадимович', 0)) { echo 'OK'; if (file_put_contents($fn . '.signAtt1', $resOneSign)) { echo ' SAVED'; } else { echo ' SAVE ERR'; } } else { echo 'ERR:' . gostGetLastError(); } if ($resTwoSign = gostSignBlock($resOneSign, 'Довереннов Петр Сергеевич', 0)) { echo 'OK'; if (file_put_contents($fn . '.signAtt', $resTwoSign)) { echo ' SAVED'; } else { echo ' SAVE ERR'; } } else { echo 'ERR:' . gostGetLastError(); } } else { echo 'Function not present.'; } echo "\r\n";
<?php // gostSignBlock ( string $sB64Data, string $ sIDCert, long bSignDetached = 1 ); // sB64Data - данные для подписи закодированные в Base64 // sIDCert - ИД сертификата подписи (CN или Thumb) // bSignDetached - (true - подпись откреплена от подписываемых данных, false - подпись содержит подписываемые данные) // возвращаемые значения: // В случае успеха - string содержащая значение подписи в кодировке Base64 // В случае неудачи - bool false. Причину ошибки можно узнать вызвав функцию gostGetLastError() // if (function_exists('gostSignBlock')) echo 'IN: '.@$argv[1].' -> FUNC:'.gostSignBlock('dGV4dCBmb3IgdGVzdA==', 'Максимов Сергей Вадимович').'.'; // else echo 'Func not found!'; // first sign //if (function_exists('gostSignBlock')) echo 'IN: '.@$argv[1].' -> FUNC:'.gostSignBlock('dGV4dCBmb3IgdGVzdA==', 'Максимов Сергей Вадимович', 0).'.'; //else echo 'Func not found!'; $pflog = gostPathFileLog('logfile.txt'); echo $pflog; echo "\r\n"; // second sign if (function_exists('gostSignBlock')) { echo 'IN: ' . @$argv[1] . ' -> FUNC:' . gostSignBlock('MIIHkgYJKoZIhvcNAQcCoIIHgzCCB38CAQExDDAKBgYqhQMCAgkFADAcBgkqhkiG9w0BBwGgDwQNdGV4dCBmb3IgdGVzdKCCBIMwggR/MIIELKADAgECAgoSCON6AAAAAFbbMAoGBiqFA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VTEVMBMGA1UEBwwM0JzQvtGB0LrQstCwMTAwLgYDVQQKDCfQpNCT0KPQnyDQk9Cd0JjQktCmINCk0J3QoSDQoNC+0YHRgdC40LgxMDAuBgNVBAsMJ9Cj0LTQvtGB0YLQvtCy0LXRgNGP0Y7RidC40Lkg0YbQtdC90YLRgDEWMBQGA1UEAxMNR05JVkMgRk5TIFJVUwIKEgjjegAAAABW2zAKBgYqhQMCAhMFAARAJjuyloIMmV9kLpTrt77KIASBB0sytcdneKnIhnOhGsWdw7vAh2OpHR0zroCuZMthIgzmPfXSN4e9PrCclWRRNw==', '29d95ebe67a0bcbdc0f80e25f402e1be6114520b', 0) . '.'; } else { echo 'Func not found!'; } echo "\nLastError: " . gostGetLastError() . "\n"; // third sign if (function_exists('gostSignBlock')) { echo 'IN: ' . @$argv[1] . ' -> FUNC:' . gostSignBlock('MIIPDAYJKoZIhvcNAQcCoIIO/TCCDvkCAQExDDAKBgYqhQMCAgkFADAcBgkqhkiG9w0BBwGgDwQNdGV4dCBmb3IgdGVzdKCCCSgwggR/MIIELKADAgECAgoSCON6AAAAAFbbMAoGBiqFAwICAwUAMIHAMR4wHAYJKoZIhvcNAQkBFg91Y2luZm9AZ25pdmMucnUxCzAJBgNVBAYTAlJVMRUwEwYDVQQHDAzQnNC+0YHQutCy0LAxMDAuBgNVBAoMJ9Ck0JPQo9CfINCT0J3QmNCS0KYg0KTQndChINCg0L7RgdGB0LjQuDEwMC4GA1UECwwn0KPQtNC+0YHRgtC+0LLQtdGA0Y/RjtGJ0LjQuSDRhtC10L3RgtGAMRYwFAYDVQQDEw1HTklWQyBGTlMgUlVTMB4XDTEwMTIyOTEzMDEwMFoXDTExMTIyOTEzMTAwMFowggFUMRgwFgYIKoUDA4EDAQEMCjc3Mjk2MzMxMzExGzAZBgkqhkiG9w0BCQEWDGVlQGdhcmFudC5ydTELMAkGA1UEBhMCUlUxGDAWBgNVBAgMDzc3INCc0L7RgdC60LLQsDEZMBcGA1UEBwwQ0LMuINC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LvQtdC60YLRgNC+0L3QvdGL0Lkg0Y3QutGB0L/RgNC10YHRgTEwMC4GA1UECwwn0KPQtNC+0YHRgtC+0LLQtdGA0Y/RjtGJ0LjQuSDRhtC10L3RgtGAMRowGAYDVQQDDBHQo9CmINCT0JDQoNCQ0J3QogIKSeGb5QABAAAS2TAKBgYqhQMCAhMFAARAd6ElfhMo/b4jBTMw1rnF5GZ8x6b3z5R5V69PPwkfp/04wCJq6gBvWV1ZuWO44LH/lga1WGz3LsN/ulkFt+kRKQ==', 'Павлов Николай Юрьевич', 0) . '.'; } else { echo 'Func not found!'; } echo "\nLastError: " . gostGetLastError() . "\n";
<?php $pflog = gostPathFileLog('logfile.txt'); echo $pflog; echo "\r\n"; if (function_exists('gostSignBlock')) { $fn = '1M'; $cn = 'user'; $content = file_get_contents($fn . '.dat'); $b64content = base64_encode($content); file_put_contents($fn . '.b64', $b64content); if ($res = gostSignBlock($b64content, 'Максимов Сергей Вадимович')) { echo 'OK'; if (file_put_contents($fn . '.sign', $res)) { echo ' SAVED'; } else { echo ' SAVE ERR'; } } else { echo 'ERR:' . gostGetLastError(); } } else { echo 'Function not present.'; } echo "\r\n";