GnuPG error version 2.0.14 - encryption

When i try to encrypt a file using GnuPG the
-----BEGIN PGP MESSAGE----- is added but in the same file the -----END PGP MESSAGE----- is not added in the encrypted file using a java program. When the number of files processed is more this error is noticed. This results in a decryption error
gpg: no valid OpenPGP data found.
gpg: block_filter 0x2656130: read error (size=13663,a->size=13663)
I am using GnuPG version 2.0.14 in Linux environment. Any help on this will be appreciated

The problem was due to a bug in the program. The encrypted file contents was getting truncated. The program uses Runtime. Exec method and was not handling the input stream properly. The issue was not with GnuPG encryption tool.

Related

"Value was either too large or too small for a UInt64" using a .PFX Certificate

I am using Webpay, which is Chilean most used payment platform to accept Credit Card. I have done that succesfully in the past (on 4 websites) but on my latest one things are not going as planned. Two weeks have passed and quite a few mails between myself and Webpay's support but I didnt' move one centimeter.
To use this system I am using a library they created they are two steps: the first one is the "INTEGRATION" one, using generic certificates, I went thru this step without a problem.
Then there is the "PRODUCTION" step where I needed to generate the .key .csr and .pfx Certificates. Which I did as I done before using Win64 OpenSSL found here using those commands:
openssl genrsa -out 597034189528.key 2048
openssl req -new -key 597034189528.key -out 597034189528.csr
openssl x509 -req -days 1460 -in 597034189528.csr -signkey 597034189528.key -out 597034189528.crt
openssl pkcs12 -export -out 597034189528.pfx -inkey 597034189528.key -in 597034189528.crt
But when using the generated .PFX and running the code I got an error message saying "Value was either too large or too small for a UInt64". This occurs when calling the library at this point
wsInitTransactionOutput result = webpay.getNormalTransaction().initTransaction(amount, buyOrder, sessionId, urlReturn, urlFinal);
Since then I tried generating and regenerating again the .PFX (using different versions of the Win64 OpenSSL) but it didn't change a thing Webpay's support keeps saying that there is something wrong with the certificate.
Anybody around having had a similar issue with certificates ?
If someone feels like trying it please feel free to do so. I uploaded here the library they are providing. Somewhere inside the ZIP file look for transbank.net and run a "webpay Normal" transaction. I am getting this:
At this stage I am blind, I guess the solution is so obvious that I can't see it.
Solved !
It took time but I got to the bottom of this issue.
The certificate I originally generated was created using the latest version of OpenSSL, which was at that time version 1.1.0. The certificates that Transbank's library (the creator of WebPay) was expecting had to be generated with a OpenSSL 1.0.x version (serial number's size are different). I generated again the certificate with OpenSSL 1.0.2q: the library behaved properly and payment went thru fine. I suggested to the provider that the documentation to be amended by specifying the OpenSSL's version.

Travis-CI openssl aes-256-cbc bad decrypt "Wrong final block"

i use following travis-ci-cli command to create an encrypted-file:
travis encrypt-file src/env/data.ts src/env/data.ts.enc --add
It creates the file and related key and value on the Travis-CI.
You can see error of travis
Why do i get the wrong final block length here?
This error is a known problem when encrypting files using the Travis CLI on Windows.
Travis provides a guide here that will help you encrypt your local files with a passphrase and then store that passphrase using travis encrypt.
If you'd rather not do that, you'll have to either use Windows Subsystem for Linux or use a Linux VM to run travis encrypt-file.

Can't suppress passphrase prompt automating GPG decryption

Windows 7, GnuPG 2.1.19
I'm having a hell of time trying to automate decryption of files using GPG. I've tried all of the variations that I can find to pass the passphrase to the command line, but all continue to prompt me via the pop-up box. And, yes, I understand the security implications of including the passphrase in the command line, passphrase file, batch file, etc. Apparently, most people can get this to work:
echo mypassphrase| gpg --batch --output test.csv --passphrase-fd 0 --decrypt test.csv.pgp
I've tried using the --passphrase-file switch. I've tried using --passphrase mypassphrase. I've tried various spacing and quoting variations. I'm pulling my hair out here. Thanks for any tips!
I resolved this problem on my own. I found that in version 2.1x of GnuPG, you have to add the "--pinentry-mode loopback" option and value.

ASPNET_regiis - Failure to create exportable key set

I'm trying to create an exportable key set using aspnet regiis, here is the command I'm running:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pc "SampleKeys" -exp
But the response is the same as if the tool is given a command it doesn't recognise:
Administration utility (4.0.30319) to install and uninstall ASP.NET on the local machine.
Copyright (c) Microsoft Corporation. All rights reserved.
Followed by regular command-line help section
So I ommitted the -exp flag and just ran
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pc "SampleKeys"
Which worked fine, but when I try to export the key using this command:
aspnet_regiis -px "SampleKeys" "C:\SampleKeys.xml" -pri
I get the following:
Exporting RSA Keys to file...
Key not valid for use in specified state.
Failed!
Has anyone had this problem before? I seemed to be able to do this without issue a few months ago. I've tried this on several machines and different .NET versions already and the same result is returned....
I don't know how but right after I posted this question I was able to create an exportable key set using the same command I used before:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pc "SampleKeys" -exp
Keys are importable on other machines and work as expected

SQL Chiper command line

Can anybody advice me what I need to do in order to open ciphered (http://sqlcipher.net/) database in command line.
When I try to do something with it like watch schema it response with following message
sqlite> .schema
Error: file is encrypted or is not a database
I know password for db, I just want to figure out steps how to correctly open it. My OS is Ubuntu 11.10
Finally I managed to do that, in case if somebody need it, here is my steps:
I've started from http://sqlcipher.net/introduction/ & downloaded sqlcipher.
The first problem was for me that I was unable to configure and build it from source because I have no libcrypto.a which is part of openssl crypto libraries.
I've installed it apt-get install libssl-dev
Then I successfully configured sqlcipher running
$./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
$make
after that executable sqlite3 file was created and I was able to open ciphered database.
To provide a password you should execute following statement.
PRAGMA key='password'

Resources