Last active
February 22, 2017 01:59
-
-
Save songxing10000/587bd39abb1a66077770a14614567064 to your computer and use it in GitHub Desktop.
private_key.p12 public_key.der
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface RSAEncryptor : NSObject | |
/** | |
* 加密方法 | |
* | |
* @param str 需要加密的字符串 | |
* @param path '.der'格式的公钥文件路径 | |
*/ | |
+ (NSString *)encryptString:(NSString *)str publicKeyWithContentsOfFile:(NSString *)path; | |
/** | |
* 解密方法 | |
* | |
* @param str 需要解密的字符串 | |
* @param path '.p12'格式的私钥文件路径 | |
* @param password 私钥文件密码 | |
*/ | |
+ (NSString *)decryptString:(NSString *)str privateKeyWithContentsOfFile:(NSString *)path password:(NSString *)password; | |
/** | |
* 加密方法 | |
* | |
* @param str 需要加密的字符串 | |
* @param pubKey 公钥字符串 | |
*/ | |
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey; | |
/** | |
* 解密方法 | |
* | |
* @param str 需要解密的字符串 | |
* @param privKey 私钥字符串 | |
*/ | |
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment