开发者

Java SHA1withDSA to PHP, convertible?

Any success in implementing SHA1withDSA signature with PHP? A failure reported here.

PKCS8EncodedKeySpec prvSpec = new PKCS8EncodedKeySpec(prvKeyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
PrivateKey prvKey = keyFactory.generatePrivate(prvSpec);
Signature sig = Signature.getInstance("SHA1withDSA开发者_Python百科");
sig.initSign(prvKey);
sig.update(text);
byte[] result = sig.sign();


You are after the PHP OpenSSL extension.

Specifically, load the private key with openssl_pkey_get_private() and create the signature with openssl_sign(), passing OPENSSL_ALGO_DSS1 as $signature_alg.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜