You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like this issues has been reported before in other places of PgpCore.
In our case it is triggered in the private async Task DecryptAsync(Stream inputStream, Stream outputStream)
If we change if (message is PgpOnePassSignatureList) in PGP.cs L5030
to if (message is PgpOnePassSignatureList || message is PgpSignatureList) then the file we have received can successfully be decrypted.
I don't know how the file has been generated other than it seems to be done by BouncyCastle Java?:
-----BEGIN PGP MESSAGE-----
Version: BCPG v1.61
I had a quick look at private async Task DecryptAndVerifyAsync(Stream inputStream, Stream outputStream) as well and the following should perhaps be added:
else if (message is PgpSignatureList pgpSignatureList)
{
var keyIdToVerify = pgpSignatureList[0].KeyId;
var verified = Utilities.FindPublicKey(keyIdToVerify, EncryptionKeys.VerificationKeys,
out PgpPublicKey _);
if (verified == false)
throw new PgpException("Failed to verify file.");
message = plainFact.NextPgpObject();
}
But I can't verify that at the moment cause I only have the public key, that I believe was used to sign, in a scanned document and I don't want to transcribe it. I'll update this when I receive it in proper format.
The text was updated successfully, but these errors were encountered:
Hi, yes we pretty much just have a big if statement here for each type so we occasionally get ones I haven't thought of yet which cause the same error.
I think this could definitely need some improvement so if you're happy to put in a PR to fix it for use case or to add the else in then that would be great.
mikakuru75
pushed a commit
to mikakuru75/PgpCore
that referenced
this issue
Sep 27, 2023
Seems like this issues has been reported before in other places of PgpCore.
In our case it is triggered in the private
async Task DecryptAsync(Stream inputStream, Stream outputStream)
If we change
if (message is PgpOnePassSignatureList)
in PGP.cs L5030to
if (message is PgpOnePassSignatureList || message is PgpSignatureList)
then the file we have received can successfully be decrypted.I don't know how the file has been generated other than it seems to be done by BouncyCastle Java?:
I had a quick look at
private async Task DecryptAndVerifyAsync(Stream inputStream, Stream outputStream)
as well and the following should perhaps be added:But I can't verify that at the moment cause I only have the public key, that I believe was used to sign, in a scanned document and I don't want to transcribe it. I'll update this when I receive it in proper format.
The text was updated successfully, but these errors were encountered: