anon.crypto
Interface IMyPrivateKey
- All Superinterfaces:
- IXMLEncodable, java.security.Key, java.security.PrivateKey, java.io.Serializable
- All Known Implementing Classes:
- AbstractPrivateKey, MyDSAPrivateKey, MyECPrivateKey, MyRSAPrivateKey
public interface IMyPrivateKey
- extends java.security.PrivateKey, IXMLEncodable
An interface for a private key for encryption and signing.
All private keys should implement a constructor of the following type:
public IMyPublicKey(PrivateKeyInfo a_keyInfo) throws java.security.InvalidKeyException;
It is the only possibility to create them automatically at run time. The big advantage for the
code is that it does not need to "know" that a private key class exists. It can be instantiated
nevertheless! If you implement your own private key outside the AN.ON library, you must call
anon.util.ClassUtil.loadClasses()
to read your classes into the class cache. Otherwise,
the private key may not be found.
- See Also:
anon.crypto.AsymmetricKeyPair
,
ClassUtil.loadClasses()
Fields inherited from interface java.security.PrivateKey |
serialVersionUID |
Methods inherited from interface java.security.Key |
getAlgorithm, getEncoded, getFormat |
createPublicKey
IMyPublicKey createPublicKey()
- Creates the corresponding public key to this private key.
- Returns:
- the corresponding public key to this private key
getSignatureAlgorithm
ISignatureCreationAlgorithm getSignatureAlgorithm()
- Gets the signature algorithm object that is held and initialised with this key.
It is ready to sign messages and does not need to be reinitialised by the caller.
Therefore, this method must make sure that the algorithm is initialised with this key.
- Returns:
- the signature algorithm object that is held and initialised by this key
getAsPrivateKeyInfo
org.bouncycastle.asn1.pkcs.PrivateKeyInfo getAsPrivateKeyInfo()
- Gets the private key as a PrivateKeyInfo object.
- Returns:
- the private key as a PrivateKeyInfo object