1

I'm using an ObjectivePGP library for PGP encryption is there any possible way to convert the NSString public key to PGPKey in ObjectivePGP I can't a find way to convert it to PGPKey. I read the documentation from ObjectivePGP no luck

Any help would be appreciated!

Marcin
  • 3,694
  • 5
  • 32
  • 52
Sunil Kumar
  • 468
  • 5
  • 12

1 Answers1

0

Sure, use:

+[ObjectivePGP readKeysFromData:]

use

NSData *armoredKeyData = [@"string-with-armored-key....." dataUsingEncoding:NSUTF8StringEncoding]
NSArray<PGPKey *> *keys = [ObjectivePGP readKeysFromData:armoredKeyData];

keys is an array of imported keys, for one key, just get first element.

Marcin
  • 3,694
  • 5
  • 32
  • 52
  • i tried with this method [ObjectivePGP readKeysFromData:armoredKeyData]; but it returns nil – Sunil Kumar Dec 16 '17 at 12:42
  • @SunilKumar strange, because this method never should returns `nil`. You can ask on the GitHub repo. Please provide input data with the sample you're using to use: https://github.com/krzyzanowskim/ObjectivePGP/issues – Marcin Dec 16 '17 at 21:16
  • Thanks, i will create sample and share in github issue and i have created the question for that over here also https://stackoverflow.com/questions/47845758/using-bcpg-public-key-in-objectivepgp-for-generating-pgpkey-its-return-nil – Sunil Kumar Dec 17 '17 at 08:29