Вопрос

my understanding is openssl_sign does the same as RSACryptoServiceProvider.SignData is there a openssl (or php) command the does the same as RSACryptoServiceProvider.SignHash?

Это было полезно?

Решение

figured it out.

here is how i signed data in php that is compatible with DotNETs XML signature

$private_key = "-----BEGIN PRIVATE KEY----- [private data] -----END PRIVATE KEY-----"

$sig1 = "<SIGNATURE><VERSION>1.0</VERSION><DIGEST>";

$sig2 = "</DIGEST><RSAKeyValue><Modulus>[private data]</Modulus><Exponent>[private data]</Exponent></RSAKeyValue></SIGNATURE>";

$pkeyid = openssl_get_privatekey($private_key);

openssl_sign($data, $sig,$pkeyid,OPENSSL_ALGO_SHA1);

$rsasignature = $sig1.strtoupper(bin2hex($sig)).$sig2;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top