Re: Cannot decrypt file encrypted with enQsig

2018-08-15 Thread Felix E. Klee
On Wed, Aug 15, 2018 at 12:13 PM, Peter Lebbing
 wrote:
> Here's the catch: unless you have an on-disk copy of your private
> encryption key, you can't. [if enQsig uses 3DES]

I do have a backup of the private key, but it’s 1. out of reach at the
moment and 2. it’s a pain to restore. So far, I’m still optimistic that
the sender will eventually provide me with a message that I can decrypt.

Thanks a lot for your explanations!

PS: I’m toying with the idea of switching from my smart card to a Trezor
hardware token. This would mean generating an entirely new key (only
256 bit ECC supported). OTOH there are several advantages such as the
Trezor being a well documented open source device, and – of course – its
size with integrated key pad solution. It also depends on whether I can
get either a smart card reader or the Trezor to work with
Termux/Android.

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Yubikey Card Error "sign_and_send_pubkey: signing failed: agent refused operation"

2018-08-15 Thread Lawrence Larabee
> I've got a new Yubikey NEO that I am trying to set up for SSH authentication 
> [...] PIN entry works correctly, but after this everything fails with an 
> error 100663404 and returns "signing failed: agent refused operation" 

For closure, this problem has been solved. I had too many PIN failures, so the 
stick was rejecting further attempts. Resetting the pin counter using gnupg 
--card-edit, admin, passwd fixed the problem. Now I am able to use my Yubikey 
and gpg-agent for SSH login. 

LL 
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Encrypt USB-HDD with LUKS using OpenPGP smartcard?

2018-08-15 Thread Ciprian Dorin Craciun
On Wed, Aug 15, 2018 at 1:57 PM Peter Lebbing  wrote:
> >   https://gist.github.com/cipriancraciun/c8a0dfb973b586053c167fec91093d9c
>
> Hey, that systemd service file seems to basically grab cryptsetup
> handling from the clutches of systemd, enabling all sorts of operations
> not possible with systemd's cryptsetup handling! That's really clever!


Basically I just looked at how a similar file was generated by systemd
for other `/etc/crypttab` targets and adapted.

Ciprian.

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Encrypt USB-HDD with LUKS using OpenPGP smartcard?

2018-08-15 Thread Peter Lebbing
On 06/08/18 08:38, Ciprian Dorin Craciun wrote:
> My script and systemd service file can be found at the following link:
> 
>   https://gist.github.com/cipriancraciun/c8a0dfb973b586053c167fec91093d9c

Hey, that systemd service file seems to basically grab cryptsetup
handling from the clutches of systemd, enabling all sorts of operations
not possible with systemd's cryptsetup handling! That's really clever!

I'm saving this for future reference, thanks.

Cheers,

Peter.

-- 
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at 



signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Cannot decrypt file encrypted with enQsig

2018-08-15 Thread Peter Lebbing
On 15/08/18 09:08, Felix E. Klee wrote:
> So, perhaps enQsig is using 3DES.

Good find! This sounds plausible. I myself had completely forgotten
reading about this bug.

Besides, I completely dismissed the encrypting application in this case
because it decided to encrypt the session key to your primary key as
well, which is very clearly not according to specification.

> *How do I find that out?*

Here's the catch: unless you have an on-disk copy of your private
encryption key, you can't. As I just wrote in my other answer in this
thread, the smartcard denies giving out the data it didn't like to see.
But whether 3DES was used can only be decided by looking at the
decrypted... erm... PKESK packet X-D.

If you have a computer with an on-disk copy, you could try it with that
on-disk copy and it will simply tell you when you ask for more verbosity
and stuff. The usual caveats apply: you are using a smartcard to protect
your private key material, but I'm now suggesting you use an on-disk
copy of the key. Treat it like you would if you were transferring the
key to a new smartcard to replace a broken one.

This strange product also encrypted to your primary key, but it's
probably only more difficult to use this than it is to use your
encryption key. You'd have to, again, load an on-disk copy and then
change the usage flags to make in encryption-capable. But if you don't
have a backup of the encryption key but do have one of the primary key,
you could do it. But after all this think about whether you should use
an encryption key you don't have a backup of: if your smartcard ever
dies, you can't decrypt anything anybody has ever sent you encrypted.

> Also, I don’t understand: I was assuming that all the card does is
> decrypt my session key using my private 4096 bit RSA key. *If the
> session key is a 3DES key, why should the card care?*

Because it inspects the decryption result for sanity before handing it
back to the computer. This is done because an attacker might learn
information about the private key if it were able to just have the
smartcard decrypt anything it was given. And the whole point of a
smartcard is that it should not be possible (or at least very hard) to
extract the private key from the smartcard.

I think the bug boils down to the card incorrectly dismissing the
decryption result as invalid. But I'm not intimately acquainted with the
bug, so this might be a misinterpretation.

HTH,

Peter.

-- 
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at 



signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Cannot decrypt file encrypted with enQsig

2018-08-15 Thread Peter Lebbing
On 03/08/18 09:16, Felix E. Klee wrote:
> As I would like to understand things a bit better, do you think it is
> possible to get some more details?

Answering this in any detail would be a lot of answer. But the basic
mechanism is --debug, --debug-level or perhaps just --debug-all and
sifting through it. At the same time having a copy of RFC 4880 and
PKCS#1 to explain all the numbers. The fact that it's a smartcard makes
this more difficult: when the decrypt action fails, you don't see the
actual numerical result. To protect against attacks, the smartcard
denies to divulge this data to protect the private key.

> The only difference: `Old` vs. `New` – Could this be an issue?

I don't think so. There are two ways to encode the packet tag, and GnuPG
takes the "old" if possible. RFC 4880 Section Section 4.2.

> PS: Had to think a bit that PKESK = “Public-Key Encrypted Session Key”.
> The crypto world seems to love acronyms. ;) (which does not make things
> easier for us users)

Yeah, sorry, this occured due to a transient failure in my brain matter
;-). When I wrote it, I really thought you were the first one to use the
acronym, so I could save time by using it as well. Unfortunately this
wasn't the case.

Peter.

-- 
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at 



signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Cannot decrypt file encrypted with enQsig

2018-08-15 Thread Felix E. Klee
*Update:* Yesterday, I was reading the [GnuPG wiki page on
SmartCards][1] due to another issue. At its bottom I found listed as
known bug:

  * Encrypted message with 3DES can't be decrypted with OpenPGP Card
(V2.1, V3.3 without fix)

  - Due to the bug, it results: Missing item in object 

  - See: https://dev.gnupg.org/T3576

Well, indeed if I encrypt a message with 3DES, I cannot decrypt it with
my SmartCard:

$ echo "Hello, world!" >foo
$ gpg -e -r felix.k...@inka.de --personal-cipher-preference 3DES foo
$ gpg -d --debug=crypto foo.gpg
[…]
gpg: encrypted with 4096-bit RSA key, ID 04FDF78D1679DD94, created 2
016-12-17
  "Felix E. Klee "
gpg: public key decryption failed: Missing item in object
gpg: decryption failed: No secret key
gpg: secmem usage: 0/32768 bytes in 0 blocks
$ gpg --version
gpg (GnuPG) 2.2.9
libgcrypt 1.8.3
[…]

“Missing item in object” is the same message that I get when trying to
decrypt the enQsig encrypted message! So, perhaps enQsig is using 3DES.
*How do I find that out?*

Also, I don’t understand: I was assuming that all the card does is
decrypt my session key using my private 4096 bit RSA key. *If the
session key is a 3DES key, why should the card care?*

[1]: https://wiki.gnupg.org/SmartCard

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users