bouncycastle 라이브러리를 사용할 때 이상한 오류를 받고 있어요 : 나는 bcprov145.jar bouncycastle jar 파일 (을 추가 한안드로이드 : 사이 애 노젠 모드 7 (안드로이드 2.3) + BouncyCastle 암호화 라이브러리 :있는 IllegalAccessError
ERROR/AndroidRuntime(1226): FATAL EXCEPTION: Thread-10
ERROR/AndroidRuntime(1226): java.lang.IllegalAccessError: tried to access class org.bouncycastle.crypto.engines.RSACoreEngine from class org.bouncycastle.crypto.engines.RSAEngine
ERROR/AndroidRuntime(1226): at org.bouncycastle.crypto.engines.RSAEngine.init(Unknown Source)
ERROR/AndroidRuntime(1226): at org.bouncycastle.crypto.encodings.PKCS1Encoding.init(PKCS1Encoding.java:90)
을) 이클립스 프로젝트에.
이 예외를 생성 한 코드는 다음과 같습니다
public int encrypt(byte[] source, int sourceLength, byte[] destination,
int destinationLength) throws CryptoError
{
int offset = 0;
byte[] encrypted;
org.bouncycastle.crypto.AsymmetricBlockCipher engine =
new org.bouncycastle.crypto.engines.RSAEngine();
engine = new org.bouncycastle.crypto.encodings.PKCS1Encoding(engine);
BigInteger mod = publicKey.getModulus();
BigInteger exp = publicKey.getPublicExponent();
org.bouncycastle.crypto.params.RSAKeyParameters keyParams =
new org.bouncycastle.crypto.params.RSAKeyParameters(false, mod, exp);
//When running the following line, the sh*t hits the fan....
engine.init(true, keyParams);
try
{
encrypted = engine.processBlock(source, offset, source.length);
}
catch (org.bouncycastle.crypto.InvalidCipherTextException e)
{
throw new CryptoError(e);
}
int length = Math.min(encrypted.length, destinationLength);
BufferTools.copyByteArray(encrypted, destination, length);
return length;
}
재미있는 것은이 : 그것은 unmodded 안드로이드 2.2 휴대 전화에서 완벽하게 작동,하지만 난 사이 애 노젠 모드 7.0.2.1로 modded하게, 내 전화에 오류가 (안드로이드 2.3?). modded 및 unmodded 전화는 모두 HTC Desire입니다.
프로젝트는 Android 2.2 라이브러리를 기반으로 제작되었습니다. 그게 문제 야? 그렇다면이 버전으로 구별 할 수있는 다른 빌드 프로젝트를 만들어야합니까? 매우 불쾌 할 것입니다 ....
나는 이미 비슷한 문제를 여기에 체크 아웃했습니다 : IllegalAccessError with Android and BouncyCastle하지만 그들은 내 경우에는 옵션이 아닌 bouncycastle 라이브러리를 포기하기로 결정했습니다.
단서가 있습니까?
감사합니다. – Dirk