1
根据关于http://forums.macrumors.com/showthread.php?t=551476的讨论,以下代码可用于RSA加密。密钥的数据类型(“public”)是SecKeyRef。尽管如此,我不会使用钥匙串,因为我只对密钥公开且不是秘密的加密感兴趣。那么甚至可以使用加密API呢?我目前的想法是只从我的公钥构造SecKeyRef结构并使用API。不过,我不知道结构是如何声明的。有人知道吗?你认为我的方法会起作用吗?iPhone上的RSA加密
uint8_t *pPlainText = (uint8_t*) "This is a test";
uint8_t aCipherText[1024];
size_t iCipherLength = 1024;
status = SecKeyEncrypt(public,
kSecPaddingNone,
pPlainText,
strlen((char*) pPlainText) + 1,
aCipherText,
&iCipherLength);