Module io.github.mmm.crypto
Class AbstractAsymmetricKeyPair<PR extends PrivateKey,PU extends PublicKey>
- java.lang.Object
-
- io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPair<PR,PU>
-
- Type Parameters:
PR
- type ofprivate key
.PU
- type ofpublic key
.
- All Implemented Interfaces:
AsymmetricKeyPair<PR,PU>
,KeySet
- Direct Known Subclasses:
AsymmetricKeyPairEc
,AsymmetricKeyPairGeneric
,AsymmetricKeyPairRsa
public abstract class AbstractAsymmetricKeyPair<PR extends PrivateKey,PU extends PublicKey> extends Object implements AsymmetricKeyPair<PR,PU>
Abstract base implementation ofAsymmetricKeyPair
.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected PR
privateKey
protected PU
publicKey
-
Constructor Summary
Constructors Constructor Description AbstractAsymmetricKeyPair(KeyPair keyPair)
The constructor.AbstractAsymmetricKeyPair(PR privateKey, PU publicKey)
The constructor.AbstractAsymmetricKeyPair(PR privateKey, PU publicKey, KeyPair keyPair)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
KeyPair
getKeyPair()
PR
getPrivateKey()
PU
getPublicKey()
int
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
-
privateKey
protected final PR extends PrivateKey privateKey
- See Also:
getPrivateKey()
-
publicKey
protected final PU extends PublicKey publicKey
- See Also:
getPublicKey()
-
-
Constructor Detail
-
AbstractAsymmetricKeyPair
public AbstractAsymmetricKeyPair(PR privateKey, PU publicKey)
The constructor.- Parameters:
privateKey
- theprivate key
.publicKey
- thepublic key
.
-
AbstractAsymmetricKeyPair
public AbstractAsymmetricKeyPair(KeyPair keyPair)
The constructor.- Parameters:
keyPair
- thekey pair
.
-
AbstractAsymmetricKeyPair
public AbstractAsymmetricKeyPair(PR privateKey, PU publicKey, KeyPair keyPair)
The constructor.- Parameters:
privateKey
- theprivate key
.publicKey
- thepublic key
.keyPair
- thekey pair
.
-
-
Method Detail
-
getPrivateKey
public PR getPrivateKey()
- Specified by:
getPrivateKey
in interfaceAsymmetricKeyPair<PR extends PrivateKey,PU extends PublicKey>
- Returns:
- the
private key
. Has to be kept secret.
-
getPublicKey
public PU getPublicKey()
- Specified by:
getPublicKey
in interfaceAsymmetricKeyPair<PR extends PrivateKey,PU extends PublicKey>
- Returns:
- the
public key
. May be distributed or published.
-
getKeyPair
public KeyPair getKeyPair()
- Specified by:
getKeyPair
in interfaceAsymmetricKeyPair<PR extends PrivateKey,PU extends PublicKey>
- Returns:
- the private and public key as java standard
KeyPair
.
-
-