Class KeyConfig.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • build

        public KeyConfig build()
                        throws PkiException
        Build a new instance of the configuration based on this builder.
        Specified by:
        build in interface Builder<KeyConfig>
        Returns:
        instance from this builder
        Throws:
        PkiException - when keys or certificates fail to load from keystore or when misconfigured
      • privateKey

        public KeyConfig.Builder privateKey​(PrivateKey privateKey)
        Configure a private key instance (rather then keystore and alias).
        Parameters:
        privateKey - private key instance
        Returns:
        updated builder instance
      • publicKey

        public KeyConfig.Builder publicKey​(PublicKey publicKey)
        Configure a public key instance (rather then keystore and certificate alias).
        Parameters:
        publicKey - private key instance
        Returns:
        updated builder instance
      • publicKeyCert

        public KeyConfig.Builder publicKeyCert​(X509Certificate certificate)
        Configure an X.509 certificate instance for public key certificate.
        Parameters:
        certificate - certificate instance
        Returns:
        updated builder instance
      • addCertChain

        public KeyConfig.Builder addCertChain​(X509Certificate certificate)
        Add an X.509 certificate instance to the end of certification chain.
        Parameters:
        certificate - certificate to add to certification path
        Returns:
        updated builder instance
      • addCert

        public KeyConfig.Builder addCert​(X509Certificate certificate)
        Add a certificate to the list of certificates, used e.g. in a trust store.
        Parameters:
        certificate - X.509 certificate to trust
        Returns:
        updated builder instance
      • config

        public KeyConfig.Builder config​(Config config)
        Updated this builder instance from configuration. Keys configured will override existing fields in this builder, others will be left intact. If certification path is already defined, configuration based cert-path will be added.
        Parameters:
        config - configuration to update this builder from
        Returns:
        updated builder instance