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LgR+/KKkqTfywtV1bwjey7HWWeOni37qnVFMBUDDHTJYaM0eUtxvCG0U3KghbV/FRyRVnBbc8msmbajABEBAAH+AwMCSlSlrsrd60JgFp0LAh7dDQnBn8WyhfTw9v675CHyuNaPKnDG5pp4nsHImSoUZtV2gvPBBA8fnTdBH2KlVD2+YrL3jZHki6Vt19dB7NGjPLU+nPTGlYdOGFay5wDPx2Q4kGDfjsMYdSArLuLKNVTBPW1i0ffE3MFICNx0egPWCTyEOZFOJtY0GKQqrdOD+0d0YpLesCf9oNcYWdJZBu65DCpPsryii7NvzGNVk1PD4eNnXtjG6heHLw5NOZsOL/7XUhiorE3gCPZlsm2D0Cq811nH2CX8ljdXnnOcitOVzzNHg8zG75xqW/pnfEI8BtvtprhoB7OTJw6ZBoWFGAzZI4LJujhMk2DI85AC5NNUsDhB6w0vTV3/xGTHnufsWIOX/E1TVvkpt01XyZxnOePu3Muqlf/3qIY4AK3P0PlFdE4zeZ9tcZ9mhn3+1/WltDjQN+HT3hO7/af/DT20Ej/Gkg+OBNpY2w/5OgRihUiIrgQYAwIAFQUCWiZ/SQIbAwQLCQgHBhUIAgkKCwANCRD6zdfYkP5OeQIbDJggA/9b8OAsMG+N7MLRXA7OCRjFPO3+yhlWfqmI9gKwaC0ziSGo/JWcLByRS/07BCjidjvSGIzWXonwfM+vg/7WCkHmCdTB2k//GJ42mSqnTY6ymgzid/YRT1DcXMyyWw5LyR8EZVTSROxuurZmHJwYZPSTBXYX9Rk/19T2dh5L9VGB+g==
-----END PGP SIGNATURE----
Generating pgpkey
from ObjectivePGP libaray
libaray
Tried with both the types but not able to get pgpKey
1)I have used the above publickKeyData in below code but it returns nil in NSArray of keys
NSData* publickKeyData = [publickKey
dataUsingEncoding:NSUTF8StringEncoding];
NSArray<PGPKey *> *keys = [ObjectivePGP readKeysFromData:publickKeyData];
2)I have used the above publickKeyData in below code but it returns nil in PGPPacket
NSUInteger offset = 0;
NSUInteger nextPacketOffset = 0;
PGPPacket * pgpPacket = [PGPPacketFactory packetWithData:publickKeyData offset:offset nextPacketOffset:&nextPacketOffset];
NSArray<PGPPacket*> * array = @[pgpPacket];
PGPPartialKey *pgpPartialKey = [[PGPPartialKey alloc] initWithPackets:array ];
PGPKey *pgpKey = [[PGPKey alloc] initWithSecretKey:nil publicKey:pgpPartialKey];
NSArray<PGPKey *> * pgpKeys = @[pgpKey];
i have tried with both types but not able to get the PGPKey
from ObjectivePGP libaray, i'm doing wrong this above key works in android with bouncycastle pgp but not in ObjectivePGP
How to solve this problem ?
Any help would be appreciated!
回答1:
This question is tracked in the project repository: https://github.com/krzyzanowskim/ObjectivePGP/issues/93
来源:https://stackoverflow.com/questions/47845758/using-bcpg-public-key-in-objectivepgp-for-generating-pgpkey-its-return-nil