Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while encrypt and signed #26

Open
Salmanferozkhan opened this issue Dec 1, 2020 · 3 comments
Open

Exception while encrypt and signed #26

Salmanferozkhan opened this issue Dec 1, 2020 · 3 comments

Comments

@Salmanferozkhan
Copy link

Hello can you please tell me why it is giving this error
Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKeyRing found where PgpSecretKeyRing expected

It throws only when I create keys through OpenPGP studio. otherwise, it is working fine

@Cinchoo
Copy link
Owner

Cinchoo commented Dec 2, 2020

need some sample code to look at it to advise

@Salmanferozkhan
Copy link
Author

using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt() { FileType = ChoPGPFileType.UTF8 }) { MemoryStream outStream = new MemoryStream(); using (Stream publicKeyStream = new MemoryStream(GetPublicKey()), privateKeyStream = new MemoryStream(GetPrivateKey())) { inputStream.Position = 0; pgp.EncryptAndSign(inputStream, outStream, publicKeyStream, privateKeyStream, SignPassword); return outStream.ToArray(); } }

here is the code which is working with normal private key which I generated from online website but when I generate Keys from PGPStudio so that private key is also use compression algorithm i.e ZIP so using that key so it will give exception

Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKeyRing found where PgpSecretKeyRing expected

@Cinchoo
Copy link
Owner

Cinchoo commented Dec 6, 2020

this issue is outside of library . Here are some references I found when I googled.

https://social.msdn.microsoft.com/Forums/office/en-US/d71151a4-40eb-4986-9368-1a7462214e6e/pgp-encrption-thorwing-error?forum=biztalkgeneral

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants