# Can't encrypt files with GnuPG2



## Mitch911 (Dec 7, 2014)

Hi all,

Yesterday, I wanted to change the way I made backups of my server/data and would encrypt it. So I chose GPG because I would like to use this technology for my mail, so I've already have a key.

But first, here the scene:

```
root@WebBSD:~ # uname -a
FreeBSD WebBSD 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

root@WebBSD:~ # gpg --version
gpg (GnuPG) 2.0.26
libgcrypt 1.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

root@WebBSD:~ # gpg -k
/root/.gnupg/pubring.gpg
------------------------
pub   2048R/C81E7C1B 2014-12-06
uid       [ultimate] WebBSD <xxx@xxx.xx>
sub   2048R/93A1637C 2014-12-06

pub   2048R/6349E5E0 2014-12-06
uid       [ultimate] Me <xxx@xxx.xx>

root@WebBSD:~ # gpg -edit-key 6349E5E0 then list
pub  2048R/6349E5E0  created: 2014-12-06  expires: never       usage: SCE
                     trust: ultimate      validity: ultimate
[ultimate] (1). Me <xxx@xxx.xx>
```
But when I want to encrypt a file, I've just "Abort" and 
	
	



```
pid 60311 (gpg2), uid 0: exited on signal 6
```
 in dmesg.

Here's my command: 
	
	



```
root@WebBSD:~ # gpg -e -r 6349E5E0 test.test
Abort
root@WebBSD:~ # gpg -e -vr 6349E5E0 test.test
gpg: using classic trust model
gpg: This key belongs to us
gpg: reading from `test.test'
gpg: writing to `test.test.gpg'
Abort
```
 Same with another user than root, and with GPG root key.

But encrypt with command -ca works: 
	
	



```
root@WebBSD:~ # gpg -ca
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2

jA0EAwMCgIsgwLU7tSFgySbzE/rabLkQCf30UvcgOKlptCTQHpLAEH0Qik7SNn8X
5GTrPZUVTw==
=zuoY
-----END PGP MESSAGE-----
```
 So, I really really don't know why it won't encrypt. I made my GPG key twice, rechecked everything, recompiled with different options, encrypted with all trust levels, searched on the Internet but no answer ever.

Please, can you help me?


----------



## Mitch911 (Dec 7, 2014)

I've tr_ied_ to decrypt and it's the same_!_

```
root@WebBSD:~ # gpg -o report.txt report.txt.asc

You need a passphrase to unlock the secret key for
user: "WebBSD <xxx@xxx.xx>"
2048-bit RSA key, ID 93A1637C, created 2014-12-06 (main key ID C81E7C1B)
gpg: encrypted with 2048-bit RSA key, ID 93A1637C, created 2014-12-06
      "WebBSD <xxx@xxx.xx>"
Abort
```


----------



## Mitch911 (Dec 7, 2014)

If it can help, and didn't see anything 

```
root@WebBSD:~ # gpg -r 6349E5E0 --debug-level 20 -e freebsd_forom.text
gpg: enabled debug flags: packet mpi cipher filter iobuf memory cache memstat trust extprog cardio assuan
gpg: DBG: fd_cache_open (/root/.gnupg/pubring.gpg) not cached
gpg: DBG: iobuf-1.0: open `/root/.gnupg/pubring.gpg' fd=3
gpg: DBG: iobuf-1.0: underflow: req=8192
gpg: DBG: iobuf-1.0: underflow: got=2114 rc=0
gpg: DBG: parse_packet(iob=1): type=6 length=269 (search.keyring.c.1010)
gpg: DBG: free_packet() type=6
gpg: DBG: parse_packet(iob=1): type=14 length=269 (search.keyring.c.1010)
gpg: DBG: free_packet() type=14
gpg: DBG: parse_packet(iob=1): type=6 length=269 (search.keyring.c.1010)
gpg: DBG: free_packet() type=6
gpg: DBG: fd_cache_open (/root/.gnupg/pubring.gpg) not cached
gpg: DBG: iobuf-2.0: open `/root/.gnupg/pubring.gpg' fd=4
gpg: DBG: iobuf-2.0: underflow: req=8192
gpg: DBG: iobuf-2.0: underflow: got=928 rc=0
gpg: DBG: parse_packet(iob=2): type=6 length=269 (parse.keyring.c.402)
gpg: DBG: parse_packet(iob=2): type=13 length=43 (parse.keyring.c.402)
gpg: DBG: parse_packet(iob=2): type=2 length=313 (parse.keyring.c.402)
gpg: DBG: parse_packet(iob=2): type=12 length=2 (parse.keyring.c.402)
gpg: DBG: free_packet() type=12
gpg: DBG: parse_packet(iob=2): type=2 length=284 (parse.keyring.c.402)
gpg: DBG: parse_packet(iob=2): type=12 length=2 (parse.keyring.c.402)
gpg: DBG: free_packet() type=12
gpg: DBG: iobuf-2.0: underflow: req=8192
gpg: DBG: iobuf-2.0: underflow: got=0 rc=-1
gpg: DBG: /root/.gnupg/pubring.gpg: close fd 4
gpg: DBG: fd_cache_close (/root/.gnupg/pubring.gpg) new slot created
gpg: DBG: iobuf-2.0: underflow: eof
gpg: DBG: iobuf-2.0: close `?'
gpg: DBG: finish_lookup: checking key 6349E5E0 (all)(req_usage=2)
gpg: DBG:       no suitable subkeys found - trying primary
gpg: DBG:       primary key may be used
gpg: DBG:       using key 6349E5E0
gpg: DBG: free_packet() type=6
gpg: DBG: free_packet() type=13
gpg: DBG: free_packet() type=2
gpg: DBG: free_packet() type=2
gpg: DBG: iobuf-1.0: close `file_filter(fd)'
gpg: DBG: /root/.gnupg/pubring.gpg: close fd 3
gpg: DBG: fd_cache_close (/root/.gnupg/pubring.gpg) new slot created
gpg: DBG: fd_cache_open (freebsd_forom.text) not cached
gpg: DBG: iobuf-3.0: open `freebsd_forom.text' fd=6
gpg: DBG: iobuf-3.0: ioctl `file_filter(fd)' no_cache=1
gpg: DBG: fd_cache_invalidate (freebsd_forom.text.gpg)
gpg: DBG: iobuf-4.0: create `file_filter(fd)'
gpg: DBG: iobuf-4.0: ioctl `file_filter(fd)' no_cache=1
gpg: DBG: fd_cache_open (freebsd_forom.text) not cached
gpg: DBG: iobuf-5.0: open `freebsd_forom.text' fd=8
gpg: DBG: iobuf-5.0: underflow: req=8192
gpg: DBG: iobuf-5.0: underflow: got=5 rc=0
gpg: DBG: iobuf-5.0: close `file_filter(fd)'
gpg: DBG: freebsd_forom.text: close fd 8
gpg: DBG: fd_cache_close (freebsd_forom.text) new slot created
Abort
```


----------



## Oko (Dec 7, 2014)

Have you tried to e-mail the port maintainer? I can't help you more as I am not using GPG.


----------



## Mitch911 (Dec 7, 2014)

Oko said:


> Have you tried to e-mail the port maintainer? I can't help you more as I am not using GPG.


Great idea! I didn't know about port maintainer  I think I will contact the maintainer and GnuPG for some help.
But before, I have to be sure it was port or release problem and not my VPS.


----------



## Mitch911 (Dec 8, 2014)

OK, so on my VM with FreeBSD 10.1 it works. !!! So I will maybe recompile all my dependencies and retry.


----------



## Mitch911 (Dec 26, 2014)

Still doesn't work and don't know why 
There is no reason...


----------



## talsamon (Dec 27, 2014)

Have you try creating a new key?


----------



## Mitch911 (Dec 27, 2014)

Yep, several times...

And "Abort" message when I try to encrypt with the new key, or to my public key...


----------



## wblock@ (Dec 27, 2014)

How did you install gpg?


----------

