Class SunECKeyLoader

  • All Implemented Interfaces:
    KeyLoader

    public class SunECKeyLoader
    extends java.lang.Object
    implements KeyLoader
    Used to load JCA public and private keys from conf/keys/publickey and conf/keys/privatekey
    • 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.String getSignatureAlgorithm()
      Get the signature algorithm specified by the key.
      java.security.PrivateKey loadPrivateKey()
      Loads the private key of this process
      java.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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SunECKeyLoader

        public SunECKeyLoader​(int id,
                              java.lang.String configHome,
                              boolean defaultKeys,
                              java.lang.String sigAlgorithm)
        Creates a new instance of ECDSAKeyLoader
    • 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 interface KeyLoader
        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 key
        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

        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 interface KeyLoader
        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 interface KeyLoader
        Returns:
        the PrivateKey loaded from config/keys/publickey
        Throws:
        java.lang.Exception - problems reading or parsing the key
        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

        public java.lang.String getSignatureAlgorithm()
        Description copied from interface: KeyLoader
        Get the signature algorithm specified by the key.
        Specified by:
        getSignatureAlgorithm in interface KeyLoader
        Returns:
        The signature algorithm specified by the key.