使用RSA解密时出错.该代码适用于android 4.4 kit kat,但相同的应用程序不适用于Android 5.0棒棒糖.
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(new BigInteger(modulusBytes), new BigInteger(exponentBytes));
RSAPublicKey publicKey = (RSAPublicKey) keyFactory.generatePublic(pubKeySpec);
byte[] decrypted = null;
try {
// get an RSA cipher object and print the provider
final Cipher cipher = Cipher.getInstance("RSA/None/NoPadding");
// decrypt the text using the public key
cipher.init(Cipher.DECRYPT_MODE, publicKey);
decrypted = cipher.doFinal(area_fissa_byte);
} catch (Exception ex) {
ex.printStackTrace();
Log.d("error","error");
}
Run Code Online (Sandbox Code Playgroud)
错误是:java.security.SignatureException:错误:04067084:rsa例程:RSA_EAY_PUBLIC_DECRYPT:数据对于模数而言太大.
我的目标是:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" /> 对于Android 4.4
你知道这是什么问题吗?
编辑: 我注意到我有两个不同长度的公钥!Android 5:我有382/383位(太小)Android 4.4:我有384位(确定)
EDIT2: …
我们在Microsoft Azure中创建了一个Linux Web App。该应用程序是用React(HTML和Javascript)静态编写的。我们将代码复制到了wwwroot文件夹中,但是该应用程序仅仅显示hostingstart.html,并且当我们尝试获取页面index.html时出现以下错误:
Cannot GET /index.html
我们尝试在GitHub(https://github.com/Azure-Samples/html-docs-hello-world)中使用Azure的示例,但错误是相同的。网址是这样的:https://consoleadmin.azurewebsites.net/index.html
上周,应用程序运行正常。
我们忘了做什么?