Sidebar

Getting a mark/reset exception during PGP decryption

0 votes
442 views
asked Mar 27, 2020 by scott-b-8720 (560 points)
edited Apr 1, 2020 by scott-b-8720

I'm getting an error that indicates

WrappedException: Wrapped java.io.IOException: mark/reset not supported

...when i'm attempting to execute this:

var messageBytes = source.getBytes();
var value = qie.pgpDecryptBytesWithoutVerify(messageBytes, '<path to private key file>', '<private key password>')
message.setBytes(value);

Anyone else ever done a PGP decryption?  If so, any ideas for getting around that error?

commented Apr 1, 2020 by scott-b-8720 (560 points)
I've added the full code that i'm executing.  The path to the private key is through a file share.  I'll check that out to make sure my local qie account has access to that account.
commented Apr 1, 2020 by scott-b-8720 (560 points)
I changed my code to this, and it worked.  Thank you, Mike.

var messageBytes = source.getBytes();
var privateKeyBytes = qie.readFile('<path to private key>');
var value = qie.pgpDecryptBytesWithoutVerify(messageBytes, privateKeyBytes, '<private key password>');
message.setBytes(value);

1 Answer

0 votes
 
Best answer

The nature of that error signifies that the underlining stream can't be buffered and read.  I would start by checking the path to the private key, which should be the file path for the pgp key, or the raw bytes of the key.  Can you share some more of the surrounding code for more context?

Also at the bottom of this KB there is a sample channel for using the PGP functions: https://www.qvera.com/kb/index.php/2263/need-encrypt-file-pgp-before-uploading-site-what-best-way-this?show=2263#q2263

 

answered Mar 27, 2020 by mike-r-7535 (13,830 points)
selected Apr 1, 2020 by scott-b-8720
...