2013-04-14 64 views
3

我嘗試簽署phpseclib的關鍵,當我與OpenSSL的解碼結果我得到如下:爲什麼phpseclib沒有正確簽署這個證書?

140513785948000:error:0D07209B:asn1 encoding routines:ASN1_get_object:too long:asn1_lib.c:142: 
140513785948000:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1306: 
140513785948000:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=X509 
140513785948000:error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib:pem_oth.c:83:

爲什麼這樣做呢?

(這個錯誤我花了一段時間才能弄清楚,所以我想我會幫旁邊的人這個問題出通過在這裏張貼)

回答

2

的問題是,我是裝的關鍵卻忘記初始化它。

$publicKey = new Crypt_RSA(); 
$publicKey->loadKey($key); 
$publicKey->setPublicKey(); //this line was missing 
相關問題