PgpCore Exception regarding encrypted formate detection
Hi!
I am currently trying to integrate your amazing work regarding the encrypt and decrypt functions into a bigger architecture. The encryption function is working like a charm but I can't seem to get to decrypt running.
When feeding the function with encrypted content in the body, the function is always throwing the following exception:
System.Private.CoreLib: Exception while executing function: PGPDecrypt. PgpCore: Failed to detect encrypted content format. (Parameter 'inputStream').
I can't seem to get it working - I did no changes to the function code itself but I can of course provide the code. I can provide some test request if needed too.
I am happy for any pointers in the right direction, since I seem to be blind.
Hi!
Is the encrypted data in ASCII format? Something like this:
-----BEGIN PGP MESSAGE----- Version: BCPG C# v1.9.0.0
hQIMAx6VCt+CxWHGAQ//f8YbUW67e4AHUyOvPmnrlj6TOXa92g6fRYtrdncqLyOR KjMmXEw78Fqo5Yj0Hi7hpEIde4AVbCuK+NvMILztzDS2Zv3OoCe9LzbNon8B1lYv xqAS9TKlEg9TG2+eMULacb04UsCMKXqGofZIgf4/5w5cPCNpduZuVV+g2IttEBeD ESds2kc+g3baX1JjtfR+Kmh2dcTUbZG+ka7h2wE2eFbrHVXDwGZB5wzkP40W/ETe uL5uH1ZsPSMxN3PI44DZX5srtXuWer+FM6HZ4FOqWIK5/tc71CWAwkhJFcBOOeQt a4SYAqxTi++HxITgiBVtImjJYwuHI2e3eGqbbfoSk8bHkVV9NI2jlmD71SNWvGqt /dBFSvXyuGsNN9mQX7DA6ouZyUVbyTbLZjAIO/EKf3lZFgJx2CJ2RDp5mgl2TvnB Up4xEaw0JQlgvDlP6OgT9hw2LIXACmlD8v7XRDUkhH+KWZZEJV45dgjLNXyskcDv Wts67P5cBhyQAGJKVrc4Z66jHke2pvM3PybHdM9uS53IWmceYAeaBgAEALT/FjuI nXrHrHaSd5DMKAUzhAtZXVLZgobZXFTJaA31wW3xqX7IGj6kLvQhYuJEarJx/Mlz p8h8x9CDhThF/CNiqizlmFr0d/v2afQKrVx8gx+Bbs2mtGtoYoPxAPs8wv6Uup7S NgF5JGAov1YEnJxKTVPz5XmP7kXTNye3ReQvTT2rPMZnDb2gDOqKYM/2DUkmZ6x0 P8GfSd64nA== =ZshN -----END PGP MESSAGE-----
Hi, thanks for the super fast reply!
Yeah it is:
-----BEGIN PGP MESSAGE----- Version: BCPG C# v1.9.0.0
h[...] [...]Q -----END PGP MESSAGE-----
Currently testing with the reply from the PGPEncrypt function if that is relevant.
That should work! How are you sending the body? Does it work locally with e.g. Postman?
Currently testing with Postman, I tried multiple ways of sending the body, currently my request looks like this
POST http://localhost:7071/api/PGPDecrypt: {
"Request Headers": {
"content-type": "application/octet-stream",
"content-length": "841"
},
"Request Body": "-----BEGIN PGP MESSAGE-----\nVersion: BCPG C# v1.9.0.0\n\nh[...]\n=pt3t\n-----END PGP MESSAGE-----",
}
I redacted some of the body and some parameters. When sending the request like that, I get another exception though.
Exception while executing function: PGPDecrypt. BouncyCastle.Crypto: invalid armor.
Am I just sending the request wrongly?
Sorry I don't know what is causing the error, I just tested and copy pasting the results from PGPEncrypt into a new Postman request works fine for me.
Thank you for the time and efforts. I will let you know if I find the issue.