Tag: PHPOpenSSL

如何在iOS Objective-C中实现php的openssl_encrypt()方法?

我想在iOS Objective-C中实现php的openssl_encrypt()方法。 所以我试了这个代码: #import <CommonCrypto/CommonHMAC.h> #import <CommonCrypto/CommonCryptor.h> – (void)viewDidLoad { [super viewDidLoad]; NSData *dataIn = [@"123456" dataUsingEncoding:NSISOLatin1StringEncoding]; NSString *key = @"ygXa6pBJOWSAXXX/J6POVTjvJpMIiPAMQiTMjBrcOGw="; NSData *decodedKeyData = [[NSData alloc] initWithBase64EncodedString:key options:0]; uint8_t randomBytes[16]; NSMutableString *ivStr; int result = SecRandomCopyBytes(kSecRandomDefault, 16, randomBytes); if(result == 0) { ivStr = [[NSMutableString alloc] initWithCapacity:16]; for(NSInteger index = 0; index < 8; index++) […]