|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.me.security.KeyPairGenerator
This class is used for generating keypairs for asymetric, cryptographic systems like
To create a keypair, just fetch an instance of a keypairgenerator and initialize it with the corresponding values:
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
kpg.initialize(2048, null, secrandom);
CryptoBag keyPair = kpg.generateKeyPair();
Currently, the aliases RSA
and DSA
( for RSA and DSA keypairgenerators) are supported.
If you want to use your own implementation of a keypairgenerator you can simply add it to the framework via:
register("RSA", "iaik.me.security.rsa.RSAKeyPairGenerator");
and use the implementation with the means described above.
Remeber, if you develop your own keypairgenerator you have to extend this class to be able to insert your generator into the framework.
Constructor Summary | |
protected |
KeyPairGenerator()
|
Method Summary | |
abstract CryptoBag |
generateKeyPair()
This method generates a new keypair with the previously initialized parameters and returns it as a CryptoBag object. |
static KeyPairGenerator |
getInstance(String algorithm)
This method instatiates a new KeyPairGenerator. |
abstract void |
initialize(int keyLength,
Object parameter,
SecureRandom random)
This method initializes the keypairgenerator with specific parameters. For the parameters, see the details of the RSA- and DSA keypairgenerator implementation ( RSAKeyPairGenerator and DSAKeyPairGenerator ). |
static void |
register(String name,
String clazz)
This method registers new keypairgenerators for usage with the KeyPairGenerator.getInstance(...) method.The generator can be added the following way:
KeyPairGenerator.register("MyOwn", "mycompany.mypackage.MyKeyPairGenerator"); |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected KeyPairGenerator()
Method Detail |
public abstract void initialize(int keyLength, Object parameter, SecureRandom random) throws CryptoException
RSAKeyPairGenerator
and DSAKeyPairGenerator
).RSAKeyPairGenerator
,
DSAKeyPairGenerator
public abstract CryptoBag generateKeyPair()
CryptoBag
object.CryptoBag
public static KeyPairGenerator getInstance(String algorithm) throws CryptoException
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
Generators are currently available for
algorithm
- the algorithm of the asymetric keypairgenerator (may be RSA or DSA)CryptoException
- if the specified keypairgenerator implementation is not available.public static void register(String name, String clazz)
KeyPairGenerator.getInstance(...)
method.
KeyPairGenerator.register("MyOwn", "mycompany.mypackage.MyKeyPairGenerator");
KeyPairGenerator kpg = KeyPairGenerator.getInstance("MyOwn");
name
- the alias for the keypairgenerator implementation.clazz
- the fully qualified classname, for e.g. : iaik.me.security.rsa.RSAKeyPairGenerator
|
This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |