Package bftsmart.reconfiguration.util
Class RSAKeyLoader
- java.lang.Object
-
- bftsmart.reconfiguration.util.RSAKeyLoader
-
-
Constructor Summary
Constructors Constructor Description RSAKeyLoader(int id, java.lang.String configHome, boolean defaultKeys, java.lang.String sigAlgorithm)
Creates a new instance of RSAKeyLoader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getSignatureAlgorithm()
Get the signature algorithm specified by the key.java.security.PrivateKey
loadPrivateKey()
Loads the private key of this processjava.security.PublicKey
loadPublicKey()
Fetches the public key for this replica/client.java.security.PublicKey
loadPublicKey(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.CertificateException
Loads the public key of some processes from configuration files- Specified by:
loadPublicKey
in 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.CertificateException
Description copied from interface:KeyLoader
Fetches the public key for this replica/client.- Specified by:
loadPublicKey
in 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.InvalidKeySpecException
Loads the private key of this process- Specified by:
loadPrivateKey
in 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:KeyLoader
Get the signature algorithm specified by the key.- Specified by:
getSignatureAlgorithm
in interfaceKeyLoader
- Returns:
- The signature algorithm specified by the key.
-
-