Package net.i2p.crypto
Class KeyGenerator
java.lang.Object
net.i2p.crypto.KeyGenerator
Define a way of generating asymmetrical key pairs as well as symmetrical keys
- Author:
- jrandom
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Deprecated.use getElGamalExponentSize() which allows override in the properties -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionObject[]
ElGamal only.ElGamal only.generatePKIKeys
(EncType type) Supports EncTypesGenerate a private 256 bit session keygenerateSessionKey
(byte[] salt, byte[] passphrase) PBE the passphrase with the salt.Object[]
Generate a pair of DSA keys, where index 0 is a SigningPublicKey, and index 1 is a SigningPrivateKey.DSA-SHA1 only.generateSigningKeys
(SigType type) Generic signature type, supports DSA, RSA, ECDSA, EdDSAint
static KeyGenerator
static PublicKey
getPublicKey
(PrivateKey priv) Convert a PrivateKey to its corresponding PublicKey.static SigningPublicKey
Convert a SigningPrivateKey to a SigningPublicKey.static void
Usage: KeyGenerator [sigtype...]boolean
-
Field Details
-
PUBKEY_EXPONENT_SIZE
Deprecated.use getElGamalExponentSize() which allows override in the properties
-
-
Constructor Details
-
KeyGenerator
-
-
Method Details
-
getInstance
-
generateSessionKey
Generate a private 256 bit session key- Returns:
- session key
-
generateSessionKey
PBE the passphrase with the salt. Warning - SLOW -
useLongElGamalExponent
public boolean useLongElGamalExponent()- Since:
- 0.9.8
-
getElGamalExponentSize
public int getElGamalExponentSize()- Since:
- 0.9.8
-
generatePKIKeypair
ElGamal only. Generate a pair of keys, where index 0 is a PublicKey, and index 1 is a PrivateKey- Returns:
- pair of keys
-
generatePKIKeys
ElGamal only. Same as generatePKIKeypair() but different return type.- Since:
- 0.8.7
-
generatePKIKeys
Supports EncTypes- Since:
- 0.9.38
-
getPublicKey
Convert a PrivateKey to its corresponding PublicKey. As of 0.9.38, supports EncTypes- Parameters:
priv
- PrivateKey object- Returns:
- the corresponding PublicKey object
- Throws:
IllegalArgumentException
- on bad key
-
generateSigningKeypair
Generate a pair of DSA keys, where index 0 is a SigningPublicKey, and index 1 is a SigningPrivateKey. DSA-SHA1 only.- Returns:
- pair of keys
-
generateSigningKeys
DSA-SHA1 only. Same as above but different return type- Since:
- 0.8.7
-
generateSigningKeys
Generic signature type, supports DSA, RSA, ECDSA, EdDSA- Throws:
GeneralSecurityException
- Since:
- 0.9.9
-
getSigningPublicKey
Convert a SigningPrivateKey to a SigningPublicKey. As of 0.9.16, supports all key types.- Parameters:
priv
- a SigningPrivateKey object- Returns:
- a SigningPublicKey object
- Throws:
IllegalArgumentException
- on bad key or unknown type
-
main
Usage: KeyGenerator [sigtype...]
-