/** * Change the key that is associated with the given ACME account. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @throws AcmeException if an error occurs while attempting to change the key that is associated with the given ACME account */ public void changeAccountKey(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); SelfSignedX509CertificateAndSigningKey newCertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(account.getKeySize()) .setKeyAlgorithmName(account.getKeyAlgorithmName()) .setDn(account.getDn()) .build(); changeAccountKey(account, staging, newCertificateAndSigningKey.getSelfSignedCertificate(), newCertificateAndSigningKey.getSigningKey()); }
return new SelfSignedX509CertificateAndSigningKey(this); } catch (Exception e) { throw log.selfSignedCertificateGenerationFailed(e);
SelfSignedX509CertificateAndSigningKey certificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(keySize) .setKeyAlgorithmName(keyAlgorithmName) .setDn(dn) .build(); privateKey = certificateAndSigningKey.getSigningKey(); certificate = certificateAndSigningKey.getSelfSignedCertificate(); signatureAlgorithm = getDefaultCompatibleSignatureAlgorithmName(privateKey); if (signatureAlgorithm == null) {
return new SelfSignedX509CertificateAndSigningKey(this); } catch (Exception e) { throw log.selfSignedCertificateGenerationFailed(e);
SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setDn(dn) .setKeyAlgorithmName(keyAlgorithmName) .build(); PKCS10CertificateSigningRequest.Builder csrBuilder = PKCS10CertificateSigningRequest.builder() .setCertificate(selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate()) .setSigningKey(selfSignedX509CertificateAndSigningKey.getSigningKey()) .setSubjectDn(dn); csrBuilder.addExtension(new SubjectAlternativeNamesExtension(false, generalNames)); PrivateKey privateKey = selfSignedX509CertificateAndSigningKey.getSigningKey(); return new X509CertificateChainAndSigningKey(certificateChain, privateKey); } finally {
return new SelfSignedX509CertificateAndSigningKey(this); } catch (Exception e) { throw log.selfSignedCertificateGenerationFailed(e);
private void createKeyStoreTrustStore(KeyStore keyStore, KeyStore trustStore, String DN, String alias) throws Exception { X500Principal principal = new X500Principal(DN); SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeyAlgorithmName("RSA") .setSignatureAlgorithmName("SHA256withRSA") .setDn(principal) .setKeySize(1024) .build(); X509Certificate certificate = selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate(); keyStore.setKeyEntry(alias, selfSignedX509CertificateAndSigningKey.getSigningKey(), KEYSTORE_CREATION_PASSWORD, new X509Certificate[]{certificate}); trustStore.setCertificateEntry(alias, certificate); }
return new SelfSignedX509CertificateAndSigningKey(this); } catch (Exception e) { throw log.selfSignedCertificateGenerationFailed(e);
private static void createKeyStoreTrustStore(KeyStore keyStore, KeyStore trustStore, String DN, String alias) throws Exception { X500Principal principal = new X500Principal(DN); SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeyAlgorithmName("RSA") .setSignatureAlgorithmName("SHA256withRSA") .setDn(principal) .setKeySize(1024) .build(); X509Certificate certificate = selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate(); keyStore.setKeyEntry(alias, selfSignedX509CertificateAndSigningKey.getSigningKey(), KEYSTORE_CREATION_PASSWORD, new X509Certificate[]{certificate}); if(trustStore != null) trustStore.setCertificateEntry(alias, certificate); }
private static void createKeyStoreTrustStore(KeyStore keyStore, KeyStore trustStore, String DN, String alias) throws Exception { X500Principal principal = new X500Principal(DN); SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeyAlgorithmName("RSA") .setSignatureAlgorithmName("SHA256withRSA") .setDn(principal) .setKeySize(1024) .build(); X509Certificate certificate = selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate(); keyStore.setKeyEntry(alias, selfSignedX509CertificateAndSigningKey.getSigningKey(), KEYSTORE_CREATION_PASSWORD, new X509Certificate[]{certificate}); if(trustStore != null) trustStore.setCertificateEntry(alias, certificate); }
/** * Change the key that is associated with the given ACME account. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @throws AcmeException if an error occurs while attempting to change the key that is associated with the given ACME account */ public void changeAccountKey(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); SelfSignedX509CertificateAndSigningKey newCertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(account.getKeySize()) .setKeyAlgorithmName(account.getKeyAlgorithmName()) .setDn(account.getDn()) .build(); changeAccountKey(account, staging, newCertificateAndSigningKey.getSelfSignedCertificate(), newCertificateAndSigningKey.getSigningKey()); }
/** * Change the key that is associated with the given ACME account. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @throws AcmeException if an error occurs while attempting to change the key that is associated with the given ACME account */ public void changeAccountKey(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); SelfSignedX509CertificateAndSigningKey newCertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(account.getKeySize()) .setKeyAlgorithmName(account.getKeyAlgorithmName()) .setDn(account.getDn()) .build(); changeAccountKey(account, staging, newCertificateAndSigningKey.getSelfSignedCertificate(), newCertificateAndSigningKey.getSigningKey()); }
/** * Change the key that is associated with the given ACME account. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @throws AcmeException if an error occurs while attempting to change the key that is associated with the given ACME account */ public void changeAccountKey(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); SelfSignedX509CertificateAndSigningKey newCertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(account.getKeySize()) .setKeyAlgorithmName(account.getKeyAlgorithmName()) .setDn(account.getDn()) .build(); changeAccountKey(account, staging, newCertificateAndSigningKey.getSelfSignedCertificate(), newCertificateAndSigningKey.getSigningKey()); }
SelfSignedX509CertificateAndSigningKey certificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(keySize) .setKeyAlgorithmName(keyAlgorithmName) .setDn(dn) .build(); privateKey = certificateAndSigningKey.getSigningKey(); certificate = certificateAndSigningKey.getSelfSignedCertificate(); signatureAlgorithm = getDefaultCompatibleSignatureAlgorithmName(privateKey); if (signatureAlgorithm == null) {
SelfSignedX509CertificateAndSigningKey certificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(keySize) .setKeyAlgorithmName(keyAlgorithmName) .setDn(dn) .build(); privateKey = certificateAndSigningKey.getSigningKey(); certificate = certificateAndSigningKey.getSelfSignedCertificate(); signatureAlgorithm = getDefaultCompatibleSignatureAlgorithmName(privateKey); if (signatureAlgorithm == null) {
SelfSignedX509CertificateAndSigningKey certificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setKeySize(keySize) .setKeyAlgorithmName(keyAlgorithmName) .setDn(dn) .build(); privateKey = certificateAndSigningKey.getSigningKey(); certificate = certificateAndSigningKey.getSelfSignedCertificate(); signatureAlgorithm = getDefaultCompatibleSignatureAlgorithmName(privateKey); if (signatureAlgorithm == null) {
SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setDn(dn) .setKeyAlgorithmName(keyAlgorithmName) .build(); PKCS10CertificateSigningRequest.Builder csrBuilder = PKCS10CertificateSigningRequest.builder() .setCertificate(selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate()) .setSigningKey(selfSignedX509CertificateAndSigningKey.getSigningKey()) .setSubjectDn(dn); csrBuilder.addExtension(new SubjectAlternativeNamesExtension(false, generalNames)); PrivateKey privateKey = selfSignedX509CertificateAndSigningKey.getSigningKey(); return new X509CertificateChainAndSigningKey(certificateChain, privateKey); } finally {
SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setDn(dn) .setKeyAlgorithmName(keyAlgorithmName) .build(); PKCS10CertificateSigningRequest.Builder csrBuilder = PKCS10CertificateSigningRequest.builder() .setCertificate(selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate()) .setSigningKey(selfSignedX509CertificateAndSigningKey.getSigningKey()) .setSubjectDn(dn); csrBuilder.addExtension(new SubjectAlternativeNamesExtension(false, generalNames)); PrivateKey privateKey = selfSignedX509CertificateAndSigningKey.getSigningKey(); return new X509CertificateChainAndSigningKey(certificateChain, privateKey); } finally {
SelfSignedX509CertificateAndSigningKey selfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setDn(dn) .setKeyAlgorithmName(keyAlgorithmName) .build(); PKCS10CertificateSigningRequest.Builder csrBuilder = PKCS10CertificateSigningRequest.builder() .setCertificate(selfSignedX509CertificateAndSigningKey.getSelfSignedCertificate()) .setSigningKey(selfSignedX509CertificateAndSigningKey.getSigningKey()) .setSubjectDn(dn); csrBuilder.addExtension(new SubjectAlternativeNamesExtension(false, generalNames)); PrivateKey privateKey = selfSignedX509CertificateAndSigningKey.getSigningKey(); return new X509CertificateChainAndSigningKey(certificateChain, privateKey); } finally {
throw ROOT_LOGGER.keyStoreAliasAlreadyExists(alias); SelfSignedX509CertificateAndSigningKey.Builder certAndKeyBuilder = SelfSignedX509CertificateAndSigningKey.builder(); certAndKeyBuilder.setDn(new X500Principal(distinguishedName)); if (algorithm != null) { final PrivateKey privateKey = certAndKey.getSigningKey(); final X509Certificate[] certChain = new X509Certificate[1]; certChain[0] = certAndKey.getSelfSignedCertificate(); keyStore.setKeyEntry(alias, privateKey, keyPassword, certChain); } catch (IllegalArgumentException e) {