我想通过将指数和模数作为私钥在iPhone上解密RSA编码的blob。在Java(带javax.crypto中),这可以很容易地通过这样的代码来实现:iOS - 从指数+模数创建SecKeyRef
// 1) key
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(myModulus, myPublicExponent);
KeyFactory fact = KeyFactory.getInstance("RSA");
Key pubKey = fact.generatePublic(keySpec);
// 2) cypher
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.DECRYPT_MODE, keySpec);
// 3) use cypher to decode my block to an output stream
但随着iPhone的安全API我不能创建一个SecKeyRef(键)比生成一对或导入其他证书,我没有/想要。
有没有办法创建一个手动模数+指数的密钥?如果是这样,你能给我一些线索吗?
在此先感谢
我有同样的问题。如果你有一些示例代码/链接plz帮助我,你能指导我吗? – 2012-12-03 11:14:31