gnupg - Are GPG keys generated on windows as secure as ones generated on linux?

06
2014-04
  • Mark0978

    Under linux you run out of system Entropy when trying to generate GPG keys unless you use /dev/urandom. Under windows, you get the speed of /dev/urandom without any tweaks. Does windows have that much extra entropy, or are the keys just less secure?

    This is a link that discusses /dev/urandom generating less secure keys for those that aren't familiar with why this might be a problem. https://bugs.launchpad.net/ubuntu/+source/gnupg/+bug/706011

  • Answers
  • mnmnc

    I would say it mostly depends on the entropy pool and how entropy is collected.

    I found this:

    Microsoft Windows releases newer than 95A feature the CryptoAPI (CAPI) API that gathers entropy in a similar fashion to Linux kernel's /dev/random.[11] Windows's CryptoAPI uses the binary registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed to store a seeded value from all of its entropy sources.[12] Because CryptoAPI is closed-source, some free and open source software applications running on the Windows platform use other measures to get randomness. For example, GnuPG, as of version 1.06, uses a variety of sources such as the number of free bytes in memory that combined with a random seed generate the desired randomness it needs.[13] Programmers using CAPI can get entropy by calling CAPI's CryptGenRandom(), after properly initialising it

    I hope it helps or points you in the right direction to follow.


  • Related Question

    gnupg - gpg: WARNING: message was not integrity protected
  • Darius

    I'm a little confused as what this means.

    What's happened is that someone has encrypted a message for me using my public key, and signed it with their private key - as per usual.

    Next, I decrypt the message...

    -bash-3.2$ gpg --decrypt /tmp/det_prod_cred.txt.asc 
    gpg: encrypted with 2048-bit ELG-E key, ID 2E52ED13, created 2001-10-15
          "XXXXXXX1"
    gpg: encrypted with 4096-bit RSA key, ID 0BB096A1, created 2009-08-12
          "XXXXXXX2"
    username = XXXXXXXXXX3  
    password = XXXXXXXXXX4
    gpg: Signature made Wed 12 Aug 2009 15:47:17 EST using DSA key ID C2E36CC8
    gpg: Good signature from "17155x01"
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.
    Primary key fingerprint: 826A E10D 8AAB 49A0 E9B6  0478 3A70 240F C2E3 6CC8
    gpg: WARNING: message was not integrity protected
    

    ...I know the message is verbose and I probably should understand what it is getting at - but I'm not confident that I do - so any further explanation on this would be appreciated.

    Is it basically saying that the person who has signed this message, does not pass the rules defined in my trustdb?

    $ gpg --update-trustdb
    gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
    gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
    

    While...

    $ gpg --edit-key 0xC2E36CC8
    gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it
    under certain conditions. See the file COPYING for details.
    
    
    pub  1024D/C2E36CC8  created: 2001-10-15  expires: never       usage: SCA 
                         trust: marginal      validity: unknown
    sub  2048g/2E52ED13  created: 2001-10-15  expires: never       usage: E   
    [ unknown] (1). 17155x01
    

    Notice I've only marginally trusted the key, if I fully trust it (which I can't), will the problem disappear?


  • Related Answers
  • Sam Stokes

    There are two different warnings here, and I think the other responders are assuming the one is caused by the other.

    I assume the "message was not integrity protected" warning is your main concern, since that's the title of this question. There seem to be several things that can cause that, but the one I just encountered is when GPG's "MDC protection" feature isn't enabled. I don't know what it stands for, but apparently it's a message integrity check that proves the message hasn't been tampered with.

    Apparently this feature is on by default, but gets disabled if any of the recipient keys don't specify they support it. So I just got the warning for the first time when adding a new recipient to a file I'd previously been encrypting only to myself, presumably because the new recipient didn't say they supported MDC.

    I got the warning to go away by adding --force-mdc to my GPG command. I haven't yet discovered whether this prevents the new recipient from decrypting the message...

    I'm pretty sure the other warning, about the key not being trusted, is unrelated to the "not integrity protected" warning.

  • Noon Silk

    In gpg, you don't yet 'trust' the sender. So even though it's from yourmate@whatever, you haven't set their trust level in gpg to whatever it needs to be to not get that message :)

    At least that's what I think; could be wrong. GPG docs should help though.

  • Broam

    What silky said: you don't trust the sender.

    However you may also need to sign the sender's key.