gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU Crypto] Re: [Classpathx-crypto] Problem/Bug in gnu-crypto-1.0.0


From: Casey Marshall
Subject: [GNU Crypto] Re: [Classpathx-crypto] Problem/Bug in gnu-crypto-1.0.0
Date: Wed, 06 Nov 2002 10:39:33 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stefan Prelle wrote:
> Hi!
>
> Casey Marshall wrote:
>
>> The key pair generator (like most of the algorithms in GNU crypto) needs
>> to be initialized first. For the key pair generator classes, this is the
>> setup(java.util.Map) method.
>
>> [...]
>
>> If you want to use the default values, do a call similar to:
>>
>>    keyGen.setup(new java.util.HashMap());
>>
>> sometime before you call generate().
>
>
> I figured out the need for initialization myself the last evening
> so I got working code. But thanks for the advice.
>
> Another quick question: How to I save/restore a generated
> Key to/from a bytebuffer? My first guess was the method
> "getEncoded" in combination but that didn't work.
>

Right now the IKeyPairCodec interface and its subclasses should do the
trick. Look at DSSKeyPairRawCodec - it doesn't have a factory so just
instantiate it.

The DSS*Key classes also have the getEncoded() and the valueOf(byte[])
methods, which translate keys to/from byte arrays. The problem here is
that the latter method doesn't actually work (they check for the wrong
magic number at the start of the input).

Which brings up a good point for the list: the valueOf() methods in the
DSS classes don't work, since they check for the magic values "GSDA" and
"GSDB", when it appears the correct values are "GNUA" and "GNUa".

In the meantime the attached diff should fix this.

Cheers,

- --
Casey Marshall < address@hidden > http://metastatic.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQE9yWHlgAuWMgRGsWsRAihxAJwNOfrIBBNtF4SNdco0CWrQG5qGvACfWVDJ
c7VdtsKSsGnGqDVK60XO+Ws=
=KM0U
-----END PGP SIGNATURE-----

Attachment: dssdiff
Description: application/java-vm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]