EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Signing problem in .NET

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#3894
Posted: 09/30/2007 20:03:27
by sergey kvaskov (Basic support level)
Joined: 09/30/2007
Posts: 1

Hi,

I need different hash algorithms to be used for signing.
But changing ElPGPWriter.HashAlgorithm property does not affect the algorithm which will be used.
I always get SHA1.
Only when I change ElPGPCustomSecretKey.KeyHashAlgorithm property, I get needed algorithm.

Please tell me what's wrong?
#3898
Posted: 10/01/2007 01:50:11
by Eugene Mayevski (EldoS Corp.)

What "different" do you expect? OpenPGP standard only knows MD5 and SHA1.


Sincerely yours
Eugene Mayevski
#3899
Posted: 10/01/2007 02:35:06
by Ken Ivanov (EldoS Corp.)

A small clarification: OpenPGP drafts declare support for SHA2 algorithms, and OpenPGPBlackbox also supports SHA2. Please provide us more details about the problem you are encountering so that we could try to reproduce it in our conditions. A chunk of the code you are using and information on SecureBlackbox and Framework versions being used would be enough.

#3910
Posted: 10/01/2007 11:41:41
by serguei kvaskov (Basic support level)
Joined: 09/04/2007
Posts: 4

I need SHA256 to be used for signing, not just SHA1.
This is the 'difference' I expect.
Your documentation says that ElPGPWriter.HashAlgorithm­ property can accept
different values and thus different(SHA256,...) hash algorithms can be used for signing?
Is it correct?

So far, I was unable to change hash algorithm from SHA1 to SHA256 using ElPGPWriter.HashAlgorithm­ property. Only when I change ElPGPCustomSecretKey.KeyH­ashAlgorithm property, I get SHA256.

Similar problem was reported in some posting back in March 2007 and your response was
"Seems to be a bug. Passing to HelpDesk."

Thank you

#3912
Posted: 10/01/2007 11:50:48
by Ken Ivanov (EldoS Corp.)

What exactly document signing are you trying to perform (generic or cleartext)?
#3916
Posted: 10/01/2007 13:16:38
by serguei kvaskov (Basic support level)
Joined: 09/04/2007
Posts: 4

Tried both.
#3921
Posted: 10/02/2007 04:00:34
by Ken Ivanov (EldoS Corp.)

Most likely, you are using DSA key for signing. If this is the case, then signing hash algorithm is adjusted according to Q parameter of the DSA key. I.e. one cannot use hash algorithms that produce longer results than the size of DSA Q parameter. So it is not possible to use SHA2 (-224, -256, -384, -512) hash algorithm with DSA/160 keys.
#3942
Posted: 10/03/2007 11:51:00
by serguei kvaskov (Basic support level)
Joined: 09/04/2007
Posts: 4

If I create DSA160 key using your framework, I still can change its Qbits and/or ElPGPCustomSecretKey.KeyHashAlgorithm properties (SHA 256...). Resulting signature will be in accordance to this new value, not to the initial value or ElPGPWriter.HashAlgorithm­­ property.
With your framework, if I have dsa160 key, can i use it to produce SHA256 signatures by changing KeyHashAlgorithm property or should I generate another, larger key? And why ElPGPWriter.HashAlgorithm­­ property is ignored?

On the other side, if I generate dsa256 key and change ElPGPCustomSecretKey.KeyHashAlgorithm property to SHA1, generated signature is not recognized by GnuPG. Its error msg says "DSA key requires a 256 bits or larger hash". SecureBox still can validate such signature and its HashAlgorithm property is SHA1. Why?

#3943
Posted: 10/03/2007 12:22:45
by Ken Ivanov (EldoS Corp.)

Quote
If I create DSA160 key using your framework, I still can change its Qbits and/or ElPGPCustomSecretKey.KeyH­ashAlgorithm properties (SHA 256...)

Actually, you can't. The QBits property specifies the number of bits in the Q parameter and should be used for key generation purposes only (even if you increase QBits manually for an existing key, the original Q value will be kept unchanged).

Quote
Resulting signature will be in accordance to this new value, not to the initial value or ElPGPWriter.HashAlgorithm­­­ property.

Yes -- but this signature will be incorrect.

Quote
With your framework, if I have dsa160 key, can i use it to produce SHA256 signatures by changing KeyHashAlgorithm property or should I generate another, larger key?

This question is a complex one. OpenPGP [draft] specification does not clarify how exactly this signature has to be calculated. Besides, the existing PGP implementations do not support such kind of signing. I think we will implement the ability to use SHA2 hash algorithms with DSA1 keys, however, this functionality should be used with care as many other PGP implementations won't understand it.

Quote
And why ElPGPWriter.HashAlgorithm­­­ property is ignored?

Due to above reasons the hash algorithm used with DSA1 keys is always defaulted to SHA1. This behaviour will be changed in one of the future builds.

Quote
On the other side, if I generate dsa256 key and change ElPGPCustomSecretKey.KeyH­ashAlgorithm property to SHA1, generated signature is not recognized by GnuPG. Its error msg says "DSA key requires a 256 bits or larger hash". SecureBox still can validate such signature and its HashAlgorithm property is SHA1. Why?

1. You should not change KeyHashAlgorithm property for the existing keys. This will result in unpredictable behaviour.
2. As I said above, OpenPGP specification contains certain ambiguities. The most optimal solution is to use hash algorithm whose digest size is equal to the size of Q parameter of DSA key.
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 2884 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!