我使用了RSA.h和RSA.m文件。
http://code1.okbase.net/codefile/RSA.m_2013022220938_5.html
在iOS中使用公钥加密时,我得到一个结果字符串。但是,我无法解密c#代码中的结果。
NSData *cipher = [self encryptWithKey:[self getPublicKeyRef] plainData:plainData];
NSUInteger len = cipher.length;
uint8_t *bytes = (uint8_t *)[cipher bytes];
NSMutableString *result = [NSMutableString stringWithCapacity:len * 3];
[result appendString:@"["];
for (NSUInteger i = 0; i < len; i++)
{
if (i) {
[result appendString:@","];
}
[result appendFormat:@"%d", bytes[i]];
}
[result appendString:@"]"];
NSLog(@"VALL %@ %d",result,len);//Send as byte array string