[Jsdsi-devel] Re: jsdsi.util.KeyFactory
Status: Pre-Alpha
Brought to you by:
sajma
|
From: Sean R. <sra...@ae...> - 2004-11-08 12:21:33
|
Sameer Ajmani wrote:
>Sean,
>
>In answering Will's question, I noticed that jsdsi.util.KeyPairFactory
>is does not implement a standard Java interface. Instead, it offers
>myriad create() routines and keeps and internal cache of
>KeyPairGenerators. Why is this? Perhaps we discussed this when you
>first implemented this class, but now I think there's a cleaner way to
>do it:
>
>Instead let's have a class jsdsi.util.RSAKeyPairGeneratorSpi that
>implements java.security.KeyPairGeneratorSpi. Instead of having so
>many different create() routines, the parameters for creation are
>passed via java.security.KeyPairGeneratorSpi.initialize(...). The
>parameter to initialize() is an instance of a new class,
>jsdsi.util.RSAKeyGenParameterSpec, which is a subclass of
>java.security.spec.RSAKeyGenParameterSpec; our subclass contains extra
>fields for URIs, etc.
>
>With this class, users can generate KeyPairs in the standard Java way:
>KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", new
>jsdsi.Provider()) ;
>kpg.initialize(new RSAKeyGenParameterSpec(keysize, exponent, uris));
>KeyPair kp = kpg.genKeyPair();
>assert(kp.getPublic() instanceof jsdsi.RSAPublicKey);
>assert(kp.getPrivate() instanceof java.security.interfaces.RSAPrivateKey);
>
>I believe jsdsi.util.RSAKeyPairGeneratorSpi will be somewhat easier to
>maintain than jsdsi.util.KeyPairFactory and will be more useful to
>users. I apologize for not thinking of this long ago :)
>
>If you have a good reason for why jsdsi.util.KeyPairFactory is better,
>please let me know!
>
>
I can't recollect myself. The only thing I remember was the issue with
the Sun implementation giving the same key pairs on consecutive calls
when using the 'defaults'. I'll look into it this, or next week.
Sean
--
Dr. Sean Radford, MBBS, MSc
sra...@ae...
http://www.aegeus-technology.com/
|