Skip to content

524429264/Objective-C-RSA

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Objective-C-RSA

Doing RSA encryption with Objective-C iOS

History

2015-09-26

  • New functions:
    • (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;
    • (NSData *)decryptData:(NSData *)data privateKey:(NSString *)privKey;

Usage

#import "RSA.h"
	
NSString *pubkey = @"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLuwt30JLYFvKcFOUdjPuDRdqv\nSnDb5TSdA/w0ND/GwLExpT66DeRz9+6//G//Y0y3c/yWT14k/ab1vID4U6W3vOgr\nafC0RyuIgH8ooCTNQpU+LtIoZ6qCejnux7VZ5lwWeT/9DQjWOtf6TopeRdzmOX09\nwa7c5xGGUsmi29QxDQIDAQAB\n-----END PUBLIC KEY-----";
NSString *ret = [RSA encryptString:@"hello world!" publicKey:pubkey];
NSLog(@"encrypted: %@", ret);

The PHP script for testing

See encrypt.php in the repository.

Swift version

About

Doing RSA encryption and decryption with Objective-C on iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 85.3%
  • PHP 14.7%