Interface KeyLoader

  • All Known Implementing Classes:
    ECDSAKeyLoader, RSAKeyLoader, SunECKeyLoader

    public interface KeyLoader
    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 management.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getSignatureAlgorithm()
      Get the signature algorithm specified by the key.
      java.security.PrivateKey loadPrivateKey()
      Fetches the private key for this replica/client.
      java.security.PublicKey loadPublicKey()
      Fetches the public key for this replica/client.
      java.security.PublicKey loadPublicKey​(int id)
      Fetches the public key for the specified replica/client.
    • Method Detail

      • loadPublicKey

        java.security.PublicKey loadPublicKey​(int id)
                                       throws java.io.IOException,
                                              java.security.NoSuchAlgorithmException,
                                              java.security.spec.InvalidKeySpecException,
                                              java.security.cert.CertificateException
        Fetches the public key for the specified replica/client.
        Parameters:
        id - ID of the respective replica/client.
        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 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

        java.security.PublicKey loadPublicKey()
                                       throws java.io.IOException,
                                              java.security.NoSuchAlgorithmException,
                                              java.security.spec.InvalidKeySpecException,
                                              java.security.cert.CertificateException
        Fetches the public key for this replica/client.
        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

        java.security.PrivateKey loadPrivateKey()
                                         throws java.io.IOException,
                                                java.security.NoSuchAlgorithmException,
                                                java.security.spec.InvalidKeySpecException
        Fetches the private key for this replica/client.
        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 in the configuration does not exist.
        java.security.spec.InvalidKeySpecException - If the key specs are not properly set .
      • getSignatureAlgorithm

        java.lang.String getSignatureAlgorithm()
        Get the signature algorithm specified by the key.
        Returns:
        The signature algorithm specified by the key.