/** * Build a new instance of the configuration based on this builder. * * @return instance from this builder * @throws PkiException when keys or certificates fail to load from keystore or when misconfigured */ @Override public KeyConfig build() throws PkiException { PrivateKey privateKey = this.explicitPrivateKey; PublicKey publicKey = this.explicitPublicKey; X509Certificate publicCert = this.explicitPublicCert; List<X509Certificate> certChain = new LinkedList<>(explicitCertChain); List<X509Certificate> certificates = new LinkedList<>(explicitCertificates); // fix public key if cert is provided if (null == publicKey && null != publicCert) { publicKey = publicCert.getPublicKey(); } return new KeyConfig(privateKey, publicKey, publicCert, certChain, certificates); }
/** * Build a new instance of the configuration based on this builder. * * @return instance from this builder * @throws PkiException when keys or certificates fail to load from keystore or when misconfigured */ @Override public KeyConfig build() throws PkiException { PrivateKey privateKey = this.explicitPrivateKey; PublicKey publicKey = this.explicitPublicKey; X509Certificate publicCert = this.explicitPublicCert; List<X509Certificate> certChain = new LinkedList<>(explicitCertChain); List<X509Certificate> certificates = new LinkedList<>(explicitCertificates); // fix public key if cert is provided if (null == publicKey && null != publicCert) { publicKey = publicCert.getPublicKey(); } return new KeyConfig(privateKey, publicKey, publicCert, certChain, certificates); }