Carlos Perez
2013-11-07 16:41:03 UTC
Hi
I have DSA 2 key generation working but do have one single problem I have no clue how to fix or if it is supported in C# version. When I create the keys it generates them with a SHA1, for DSA2 keys larger than 1024 we need to use SHA2 hashes or they will not import in to GPG, How can have the key generation use a different Hash size?
Here is error in GPG
PS C:\Windows\system32> gpg.exe --import C:\2BADC09B08947C59_pub.asc
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: key 08947C59: no valid user IDs
gpg: this may be caused by a missing self-signature
gpg: Total number processed: 1
gpg: w/o user IDs: 1
Here is the PGP Dump output
Old: Public Key Packet(tag 6)(814 bytes)
Ver 4 - new
Public key creation time - Thu Nov 7 16:24:18 UTC 2013
Pub alg - DSA Digital Signature Algorithm(pub 17)
DSA p(2048 bits) - ...
DSA q(256 bits) - ...
DSA g(2047 bits) - ...
DSA y(2048 bits) - ...
Old: User ID Packet(tag 13)(30 bytes)
User ID - Carlos Perez <carlos-***@public.gmane.org>
Old: Signature Packet(tag 2)(113 bytes)
Ver 4 - new
Sig type - Generic certification of a User ID and Public Key packet(0x10).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Thu Nov 7 16:24:18 UTC 2013
Hashed Sub: preferred symmetric algorithms(sub 11)(6 bytes)
Sym alg - AES with 256-bit key(sym 9)
Sym alg - AES with 192-bit key(sym 8)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - Twofish with 256-bit key(sym 10)
Sym alg - CAST5(sym 3)
Sym alg - Triple-DES(sym 2)
Hashed Sub: preferred hash algorithms(sub 21)(4 bytes)
Hash alg - SHA256(hash 8)
Hash alg - SHA384(hash 9)
Hash alg - SHA512(hash 10)
Hash alg - RIPEMD160(hash 3)
Hashed Sub: preferred compression algorithms(sub 22)(3 bytes)
Comp alg - ZLIB <RFC1950>(comp 2)
Comp alg - ZIP <RFC1951>(comp 1)
Comp alg - BZip2(comp 3)
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0xEA9E95D15045567E
Hash left 2 bytes - 82 8b
DSA r(256 bits) - ...
DSA s(252 bits) - ...
-> hash(DSA q bits)
Here is a key from GPG
Old: Public Key Packet(tag 6)(814 bytes)
Ver 4 - new
Public key creation time - Thu Nov 7 15:34:13 UTC 2013
Pub alg - DSA Digital Signature Algorithm(pub 17)
DSA p(2048 bits) - ...
DSA q(256 bits) - ...
DSA g(2046 bits) - ...
DSA y(2046 bits) - ...
Old: User ID Packet(tag 13)(37 bytes)
User ID - Carlos Perez (none) <carlos-***@public.gmane.org>
Old: Signature Packet(tag 2)(123 bytes)
Ver 4 - new
Sig type - Positive certification of a User ID and Public Key packet(0x13).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA256(hash 8)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Thu Nov 7 15:34:13 UTC 2013
Hashed Sub: key flags(sub 27)(1 bytes)
Flag - This key may be used to certify other keys
Flag - This key may be used to sign data
Hashed Sub: preferred symmetric algorithms(sub 11)(6 bytes)
Sym alg - AES with 256-bit key(sym 9)
Sym alg - AES with 192-bit key(sym 8)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - CAST5(sym 3)
Sym alg - Triple-DES(sym 2)
Sym alg - IDEA(sym 1)
Hashed Sub: preferred hash algorithms(sub 21)(5 bytes)
Hash alg - SHA256(hash 8)
Hash alg - SHA1(hash 2)
Hash alg - SHA384(hash 9)
Hash alg - SHA512(hash 10)
Hash alg - SHA224(hash 11)
Hashed Sub: preferred compression algorithms(sub 22)(3 bytes)
Comp alg - ZLIB <RFC1950>(comp 2)
Comp alg - BZip2(comp 3)
Comp alg - ZIP <RFC1951>(comp 1)
Hashed Sub: features(sub 30)(1 bytes)
Flag - Modification detection (packets 18 and 19)
Hashed Sub: key server preferences(sub 23)(1 bytes)
Flag - No-modify
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0x22548888B32E2084
Hash left 2 bytes - e6 50
DSA r(256 bits) - ...
DSA s(255 bits) - ...
-> hash(DSA q bits)
I have DSA 2 key generation working but do have one single problem I have no clue how to fix or if it is supported in C# version. When I create the keys it generates them with a SHA1, for DSA2 keys larger than 1024 we need to use SHA2 hashes or they will not import in to GPG, How can have the key generation use a different Hash size?
Here is error in GPG
PS C:\Windows\system32> gpg.exe --import C:\2BADC09B08947C59_pub.asc
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: DSA key 08947C59 requires a 256 bit or larger hash
gpg: key 08947C59: no valid user IDs
gpg: this may be caused by a missing self-signature
gpg: Total number processed: 1
gpg: w/o user IDs: 1
Here is the PGP Dump output
Old: Public Key Packet(tag 6)(814 bytes)
Ver 4 - new
Public key creation time - Thu Nov 7 16:24:18 UTC 2013
Pub alg - DSA Digital Signature Algorithm(pub 17)
DSA p(2048 bits) - ...
DSA q(256 bits) - ...
DSA g(2047 bits) - ...
DSA y(2048 bits) - ...
Old: User ID Packet(tag 13)(30 bytes)
User ID - Carlos Perez <carlos-***@public.gmane.org>
Old: Signature Packet(tag 2)(113 bytes)
Ver 4 - new
Sig type - Generic certification of a User ID and Public Key packet(0x10).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Thu Nov 7 16:24:18 UTC 2013
Hashed Sub: preferred symmetric algorithms(sub 11)(6 bytes)
Sym alg - AES with 256-bit key(sym 9)
Sym alg - AES with 192-bit key(sym 8)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - Twofish with 256-bit key(sym 10)
Sym alg - CAST5(sym 3)
Sym alg - Triple-DES(sym 2)
Hashed Sub: preferred hash algorithms(sub 21)(4 bytes)
Hash alg - SHA256(hash 8)
Hash alg - SHA384(hash 9)
Hash alg - SHA512(hash 10)
Hash alg - RIPEMD160(hash 3)
Hashed Sub: preferred compression algorithms(sub 22)(3 bytes)
Comp alg - ZLIB <RFC1950>(comp 2)
Comp alg - ZIP <RFC1951>(comp 1)
Comp alg - BZip2(comp 3)
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0xEA9E95D15045567E
Hash left 2 bytes - 82 8b
DSA r(256 bits) - ...
DSA s(252 bits) - ...
-> hash(DSA q bits)
Here is a key from GPG
Old: Public Key Packet(tag 6)(814 bytes)
Ver 4 - new
Public key creation time - Thu Nov 7 15:34:13 UTC 2013
Pub alg - DSA Digital Signature Algorithm(pub 17)
DSA p(2048 bits) - ...
DSA q(256 bits) - ...
DSA g(2046 bits) - ...
DSA y(2046 bits) - ...
Old: User ID Packet(tag 13)(37 bytes)
User ID - Carlos Perez (none) <carlos-***@public.gmane.org>
Old: Signature Packet(tag 2)(123 bytes)
Ver 4 - new
Sig type - Positive certification of a User ID and Public Key packet(0x13).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA256(hash 8)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Thu Nov 7 15:34:13 UTC 2013
Hashed Sub: key flags(sub 27)(1 bytes)
Flag - This key may be used to certify other keys
Flag - This key may be used to sign data
Hashed Sub: preferred symmetric algorithms(sub 11)(6 bytes)
Sym alg - AES with 256-bit key(sym 9)
Sym alg - AES with 192-bit key(sym 8)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - CAST5(sym 3)
Sym alg - Triple-DES(sym 2)
Sym alg - IDEA(sym 1)
Hashed Sub: preferred hash algorithms(sub 21)(5 bytes)
Hash alg - SHA256(hash 8)
Hash alg - SHA1(hash 2)
Hash alg - SHA384(hash 9)
Hash alg - SHA512(hash 10)
Hash alg - SHA224(hash 11)
Hashed Sub: preferred compression algorithms(sub 22)(3 bytes)
Comp alg - ZLIB <RFC1950>(comp 2)
Comp alg - BZip2(comp 3)
Comp alg - ZIP <RFC1951>(comp 1)
Hashed Sub: features(sub 30)(1 bytes)
Flag - Modification detection (packets 18 and 19)
Hashed Sub: key server preferences(sub 23)(1 bytes)
Flag - No-modify
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0x22548888B32E2084
Hash left 2 bytes - e6 50
DSA r(256 bits) - ...
DSA s(255 bits) - ...
-> hash(DSA q bits)