Module io.github.mmm.crypto
Class AsymmetricKeyPairRsa
- java.lang.Object
-
- io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPair<RSAPrivateKey,RSAPublicKey>
-
- io.github.mmm.crypto.asymmetric.key.rsa.AsymmetricKeyPairRsa
-
- All Implemented Interfaces:
AsymmetricKeyPair<RSAPrivateKey,RSAPublicKey>
,KeySet
public class AsymmetricKeyPairRsa extends AbstractAsymmetricKeyPair<RSAPrivateKey,RSAPublicKey>
An implementation ofAsymmetricKeyPair
forRsa
.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALGORITHM_RSA
Thealgorithm
name "RSA".-
Fields inherited from class io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPair
privateKey, publicKey
-
-
Constructor Summary
Constructors Constructor Description AsymmetricKeyPairRsa(RSAPrivateKey privateKey, RSAPublicKey publicKey)
The constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RSAPrivateKey
createPrivateKey(BigInteger modulus, BigInteger privateExponent)
static RSAPrivateKey
createPrivateKey(RSAPrivateKeySpec keySpec)
static RSAPublicKey
createPublicKey(BigInteger modulus)
static RSAPublicKey
createPublicKey(BigInteger modulus, BigInteger publicExponent)
static RSAPublicKey
createPublicKey(RSAPublicKeySpec keySpec)
static AsymmetricKeyPairRsa
of(String modulus, String privateExponent)
Convenience method e.g.static AsymmetricKeyPairRsa
of(BigInteger modulus, BigInteger privateExponent)
static AsymmetricKeyPairRsa
of(BigInteger modulus, BigInteger privateExponent, BigInteger publicExponent)
-
Methods inherited from class io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPair
equals, getKeyPair, getPrivateKey, getPublicKey, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPair
getKeys
-
-
-
-
Field Detail
-
ALGORITHM_RSA
public static final String ALGORITHM_RSA
Thealgorithm
name "RSA".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AsymmetricKeyPairRsa
public AsymmetricKeyPairRsa(RSAPrivateKey privateKey, RSAPublicKey publicKey)
The constructor.- Parameters:
privateKey
- theprivate key
.publicKey
- thepublic key
.
-
-
Method Detail
-
of
public static AsymmetricKeyPairRsa of(BigInteger modulus, BigInteger privateExponent, BigInteger publicExponent)
- Parameters:
modulus
- is themodulus
(product of two large primes).privateExponent
- theprivate exponent
.publicExponent
- thepublic exponent
.- Returns:
- the
AsymmetricKeyPair
.
-
createPublicKey
public static RSAPublicKey createPublicKey(BigInteger modulus)
- Parameters:
modulus
- themodulus
.- Returns:
- the
RSAPublicKey
.
-
createPublicKey
public static RSAPublicKey createPublicKey(BigInteger modulus, BigInteger publicExponent)
- Parameters:
modulus
- themodulus
.publicExponent
- thepublic exponent
.- Returns:
- the
RSAPublicKey
.
-
createPublicKey
public static RSAPublicKey createPublicKey(RSAPublicKeySpec keySpec)
- Parameters:
keySpec
- theRSAPublicKeySpec
.- Returns:
- the
RSAPublicKey
.
-
of
public static AsymmetricKeyPairRsa of(BigInteger modulus, BigInteger privateExponent)
- Parameters:
modulus
- is themodulus
(product of two large primes).privateExponent
- theprivate exponent
.- Returns:
- the
AsymmetricKeyPair
.
-
of
public static AsymmetricKeyPairRsa of(String modulus, String privateExponent)
Convenience method e.g. for test-data.- Parameters:
modulus
- is the modulus (product of two large primes).privateExponent
- the private key encryption exponent.- Returns:
- the
AsymmetricKeyPair
.
-
createPrivateKey
public static RSAPrivateKey createPrivateKey(BigInteger modulus, BigInteger privateExponent)
- Parameters:
modulus
- themodulus
.privateExponent
- theprivate exponent
.- Returns:
- the
RSAPrivateKey
.
-
createPrivateKey
public static RSAPrivateKey createPrivateKey(RSAPrivateKeySpec keySpec)
- Parameters:
keySpec
- theRSAPrivateKeySpec
.- Returns:
- the
RSAPrivateKey
.
-
-