Package bftsmart.reconfiguration.util
Class SunECKeyLoader
- java.lang.Object
-
- bftsmart.reconfiguration.util.SunECKeyLoader
-
-
Constructor Summary
Constructors Constructor Description SunECKeyLoader(int id, java.lang.String configHome, boolean defaultKeys, java.lang.String sigAlgorithm)Creates a new instance of ECDSAKeyLoader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetSignatureAlgorithm()Get the signature algorithm specified by the key.java.security.PrivateKeyloadPrivateKey()Loads the private key of this processjava.security.PublicKeyloadPublicKey()Fetches the public key for this replica/client.java.security.PublicKeyloadPublicKey(int id)Loads the public key of some processes from configuration files
-
-
-
Method Detail
-
loadPublicKey
public java.security.PublicKey loadPublicKey(int id) throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.security.cert.CertificateExceptionLoads the public key of some processes from configuration files- Specified by:
loadPublicKeyin interfaceKeyLoader- Parameters:
id- ID of the respective replica/client.- Returns:
- the PublicKey loaded from config/keys/publickey
- Throws:
java.lang.Exception- problems reading or parsing the keyjava.io.IOException- If there was an error reading the key file.java.security.NoSuchAlgorithmException- If the algorithm specified in the configuration does not exist.java.security.spec.InvalidKeySpecException- If the key specs are not properly set.java.security.cert.CertificateException- If there was an error loading the public key certificate.
-
loadPublicKey
public java.security.PublicKey loadPublicKey() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.security.cert.CertificateExceptionDescription copied from interface:KeyLoaderFetches the public key for this replica/client.- Specified by:
loadPublicKeyin interfaceKeyLoader- Returns:
- The replica/client's public key.
- Throws:
java.io.IOException- If there was an error reading the key file.java.security.NoSuchAlgorithmException- If the algorithm specified by the key does not exist.java.security.spec.InvalidKeySpecException- If the key specs are not properly set.java.security.cert.CertificateException- If there was an error loading the public key certificate.
-
loadPrivateKey
public java.security.PrivateKey loadPrivateKey() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecExceptionLoads the private key of this process- Specified by:
loadPrivateKeyin interfaceKeyLoader- Returns:
- the PrivateKey loaded from config/keys/publickey
- Throws:
java.lang.Exception- problems reading or parsing the keyjava.io.IOException- If there was an error reading the key file.java.security.NoSuchAlgorithmException- If the algorithm specified in the configuration does not exist.java.security.spec.InvalidKeySpecException- If the key specs are not properly set .
-
getSignatureAlgorithm
public java.lang.String getSignatureAlgorithm()
Description copied from interface:KeyLoaderGet the signature algorithm specified by the key.- Specified by:
getSignatureAlgorithmin interfaceKeyLoader- Returns:
- The signature algorithm specified by the key.
-
-