PDA

View Full Version : [ask] java bouncycastle library


Darkc0der
20th November 2011, 01:03 AM
:ceriwislove:



gan, mohon pencerahan

ceritanya lagi verifikasi tanda tangan digital antara client dan server gan

pas lagi runnig, ada error gan..

kata errornya begini gan :



org.bouncycastle.crypto.InvalidCipherTextException : unknown block type

at org.bouncycastle.crypto.encodings.PKCS1Encoding.de codeBlock(Unknown Source)

at org.bouncycastle.crypto.encodings.PKCS1Encoding.pr ocessBlock(Unknown Source)

at SecureGprs.RSADecrypt(SecureGprs.java:267)





nah kalau source yg bikin error begini gan :



public byte [] RSADecrypt (byte [] toDecrypt,RSAPrivateCrtKeyParameters _RSAPrivateKey) throws Exception

{

if (_RSAPrivateKey == null)

{

throw new Exception("Please generate RSA keys first in order to work");

}

AsymmetricBlockCipher theEngine = new RSAEngine();

theEngine = new PKCS1Encoding(theEngine);

theEngine.init(false, _RSAPrivateKey);

System.out.println("Decrypting length:"+toDecrypt.length);

// nich kalimat dibawah ini yang bikin error gan

return theEngine.processBlock(toDecrypt, 0, toDecrypt.length);

}



terima kasih agan-agan semua

:kiss:

</div>