Oops, I meant to specifically point you at the following line: https://github.com/jstedfast/MimeKit/blob/master/MimeKit/Cryptography/OpenPgpContext.cs#L341
GetPublicKey() is the core logic for doing PgpPublicKey lookups by iterating over the keys within a public keyring. Jeff On Tue, Aug 5, 2014 at 11:25 AM, Williams, Twila <twilli...@sfbli.com> wrote: > Thanks Jeff, I will try it and let you know. > > > > *From:* Jeff Stedfast [mailto:j...@xamarin.com] > *Sent:* Tuesday, August 05, 2014 10:23 AM > *To:* Williams, Twila > *Cc:* dev-crypto-csharp@bouncycastle.org > *Subject:* Re: [dev-crypto-csharp] Where and How do I code --recipient in > BouncyCastle OpenPgp class? > > > > Hi Twila, > > > > Bouncy Castle's PGP implementation has no way of looking up recipients > based on a name, it needs a PgpPublicKey to encrypt to. > > > > That said... I've implemented a higher-level library that uses Bouncy > Castle's PGP code to encrypt streams to any number of recipients using the > GnuPG keyrings by matching name strings that you can use as a starting > point. > > > > You can find my code here: > https://github.com/jstedfast/MimeKit/blob/master/MimeKit/Cryptography/OpenPgpContext.cs > > > > And my GnuPGContext subclass is at > https://github.com/jstedfast/MimeKit/blob/master/MimeKit/Cryptography/GnuPGContext.cs > (it just needs to override the locations of the keyrings). > > > > Since you are not trying to interoperate with GnuPG, but rather PGP > Corporation's PGP implementation, it *may* be as simple as specifying a > different set of keyrings paths... or it may require custom code to read > their keyrings (I don't know). > > > > Hope that my code is at least useful to start you in the right direction... > > > > Jeff > > > > On Tue, Aug 5, 2014 at 8:51 AM, Williams, Twila <twilli...@sfbli.com> > wrote: > > This is how I do it command line, but I need to code this in OpenPgp class: > > > > C:\Program Files\PGP Corporation\PGP Command Line>pgp --encrypt --armor > SunnyBrook_2014.zip --recipient " Mary Poppins" --output > SunnyBrook.zip.pgp….. > > > > > > Thanks in Advance, > > > > Twila > > > ------------------------------ > > > The views expressed in this message are those of the individual sender and > do not necessarily represent the opinion of Southern Farm Bureau Life > Insurance Company. Although this E-mail and any attachments are believed to > be free of any virus or other defect that might affect any computer system > into which it is received and opened, it is the responsibility of the > recipient to ensure that it is free of viruses or other potentially > hazardous components, and no responsibility is accepted by Southern Farm > Bureau Life Insurance Company for damage arising in any way from its use. > > > > ------------------------------ > > The views expressed in this message are those of the individual sender and > do not necessarily represent the opinion of Southern Farm Bureau Life > Insurance Company. Although this E-mail and any attachments are believed to > be free of any virus or other defect that might affect any computer system > into which it is received and opened, it is the responsibility of the > recipient to ensure that it is free of viruses or other potentially > hazardous components, and no responsibility is accepted by Southern Farm > Bureau Life Insurance Company for damage arising in any way from its use. >