public class KeyPairIdentity extends java.lang.Object implements PublicKeyIdentity, SignatureFactoriesHolder
KeyPair
to generate the identity signatureModifier and Type | Field and Description |
---|---|
protected java.security.KeyPair |
pair |
private java.util.List<NamedFactory<Signature>> |
signatureFactories |
Constructor and Description |
---|
KeyPairIdentity(SignatureFactoriesManager primary,
SignatureFactoriesManager secondary,
java.security.KeyPair pair) |
Modifier and Type | Method and Description |
---|---|
java.security.PublicKey |
getPublicKey() |
java.util.List<NamedFactory<Signature>> |
getSignatureFactories() |
java.util.Map.Entry<java.lang.String,byte[]> |
sign(SessionContext session,
java.lang.String algo,
byte[] data)
Proves the public key identity by signing the given data
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSignatureFactoriesNameList, getSignatureFactoriesNames
protected final java.security.KeyPair pair
private final java.util.List<NamedFactory<Signature>> signatureFactories
public KeyPairIdentity(SignatureFactoriesManager primary, SignatureFactoriesManager secondary, java.security.KeyPair pair)
public java.security.PublicKey getPublicKey()
getPublicKey
in interface PublicKeyIdentity
PublicKey
identity valuepublic java.util.List<NamedFactory<Signature>> getSignatureFactories()
getSignatureFactories
in interface SignatureFactoriesHolder
Signature
factoriespublic java.util.Map.Entry<java.lang.String,byte[]> sign(SessionContext session, java.lang.String algo, byte[] data) throws java.lang.Exception
PublicKeyIdentity
sign
in interface PublicKeyIdentity
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextalgo
- Recommended signature algorithm - if null
/empty then one will be selected based on the
key type and/or signature factories. Note: even if specific algorithm specified, the
implementation may disregard and choose anotherdata
- Data to signjava.lang.Exception
- If failed to sign the datapublic java.lang.String toString()
toString
in class java.lang.Object