The KeyLoader interface is used internally by BFT-SMaRt to load signature keys from disk. Developers can use implementations of this interface so that if their application uses key structures similar to the library, these keys can be shared by both the library and the application to simplify key man
| 19 | * the application to simplify key management. |
| 20 | */ |
| 21 | public interface KeyLoader { |
| 22 | |
| 23 | /** |
| 24 | * Fetches the public key for the specified replica/client. |
| 25 | * |
| 26 | * @param id ID of the respective replica/client. |
| 27 | * @return The replica/client's public key. |
| 28 | * |
| 29 | * @throws IOException If there was an error reading the key file. |
| 30 | * @throws NoSuchAlgorithmException If the algorithm specified in the configuration does not exist. |
| 31 | * @throws InvalidKeySpecException If the key specs are not properly set. |
| 32 | * @throws CertificateException If there was an error loading the public key certificate. |
| 33 | */ |
| 34 | public PublicKey loadPublicKey(int id) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, CertificateException; |
| 35 | |
| 36 | /** |
| 37 | * Fetches the public key for this replica/client. |
| 38 | * |
| 39 | * @return The replica/client's public key. |
| 40 | * |
| 41 | * @throws IOException If there was an error reading the key file. |
| 42 | * @throws NoSuchAlgorithmException If the algorithm specified by the key does not exist. |
| 43 | * @throws InvalidKeySpecException If the key specs are not properly set. |
| 44 | * @throws CertificateException If there was an error loading the public key certificate. |
| 45 | */ |
| 46 | public PublicKey loadPublicKey() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, CertificateException; |
| 47 | |
| 48 | /** |
| 49 | * Fetches the private key for this replica/client. |
| 50 | * |
| 51 | * @return The replica/client's public key. |
| 52 | * |
| 53 | * @throws IOException If there was an error reading the key file. |
| 54 | * @throws NoSuchAlgorithmException If the algorithm specified in the configuration does not exist. |
| 55 | * @throws InvalidKeySpecException If the key specs are not properly set . |
| 56 | */ |
| 57 | public PrivateKey loadPrivateKey() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException; |
| 58 | |
| 59 | /** |
| 60 | * Get the signature algorithm specified by the key. |
| 61 | * @return The signature algorithm specified by the key. |
| 62 | */ |
| 63 | public String getSignatureAlgorithm(); |
| 64 | |
| 65 | } |
no outgoing calls
no test coverage detected