NYSRSAObjC Class Reference

Inherits from NSObject
Declared in NYSRSAObjC.h
NYSRSAObjC.m

+ encrypt:PublicKey:

  • ——-RSA 字符串公钥加密——-
+ (NSString *)encrypt:(NSString *)plaintext PublicKey:(NSString *)pubKey

Parameters

plaintext

明文,待加密的字符串

pubKey

公钥字符串

Return Value

密文,加密后的字符串

Discussion

  • ——-RSA 字符串公钥加密——-

Declared In

NYSRSAObjC.h

+ encrypt:KeyFilePath:

  • ——-RSA 公钥文件加密——-
+ (NSString *)encrypt:(NSString *)plaintext KeyFilePath:(NSString *)path

Parameters

plaintext

明文,待加密的字符串

path

公钥文件路径,p12或pem格式

Return Value

密文,加密后的字符串

Discussion

  • ——-RSA 公钥文件加密——-

Declared In

NYSRSAObjC.h

+ decrypt:PrivateKey:

  • ——-RSA 私钥字符串解密——-
+ (NSString *)decrypt:(NSString *)ciphertext PrivateKey:(NSString *)privKey

Parameters

ciphertext

密文,需要解密的字符串

privKey

私钥字符串

Return Value

明文,解密后的字符串

Discussion

  • ——-RSA 私钥字符串解密——-

Declared In

NYSRSAObjC.h

+ decrypt:KeyFilePath:FilePwd:

  • ——-RSA 私钥文件解密——-
+ (NSString *)decrypt:(NSString *)ciphertext KeyFilePath:(NSString *)path FilePwd:(NSString *)pwd

Parameters

ciphertext

密文,需要解密的字符串

path

私钥文件路径,p12或pem格式(pem私钥需为pcks8格式)

pwd

私钥文件的密码

Return Value

明文,解密后的字符串

Discussion

  • ——-RSA 私钥文件解密——-

Declared In

NYSRSAObjC.h