Tabnine Logo
X509CertificateBuilder.setNotValidAfter
Code IndexAdd Tabnine to your IDE (free)

How to use
setNotValidAfter
method
in
org.wildfly.security.x500.cert.X509CertificateBuilder

Best Java code snippets using org.wildfly.security.x500.cert.X509CertificateBuilder.setNotValidAfter (Showing top 7 results out of 315)

origin: wildfly/wildfly

certificateBuilder.setNotValidAfter(notValidAfter);
origin: org.wildfly.core/wildfly-domain-management

X509Certificate generateCertificate(KeyPair pair) throws Exception {
  PrivateKey privkey = pair.getPrivate();
  X509CertificateBuilder builder = new X509CertificateBuilder();
  Date from = new Date();
  Date to = new Date(from.getTime() + (1000L * 60L * 60L * 24L * 365L * 10L));
  BigInteger sn = new BigInteger(64, new SecureRandom());
  builder.setNotValidAfter(ZonedDateTime.ofInstant(Instant.ofEpochMilli(to.getTime()), TimeZone.getDefault().toZoneId()));
  builder.setNotValidBefore(ZonedDateTime.ofInstant(Instant.ofEpochMilli(from.getTime()), TimeZone.getDefault().toZoneId()));
  builder.setSerialNumber(sn);
  X500Principal owner = new X500Principal("CN=" + autoGenerateCertHostName);
  builder.setSubjectDn(owner);
  builder.setIssuerDn(owner);
  builder.setPublicKey(pair.getPublic());
  builder.setVersion(3);
  builder.setSignatureAlgorithmName(SHA_256_WITH_RSA);
  builder.setSigningKey(privkey);
  return builder.build();
}
origin: wildfly/wildfly-core

X509Certificate generateCertificate(KeyPair pair) throws Exception {
  PrivateKey privkey = pair.getPrivate();
  X509CertificateBuilder builder = new X509CertificateBuilder();
  Date from = new Date();
  Date to = new Date(from.getTime() + (1000L * 60L * 60L * 24L * 365L * 10L));
  BigInteger sn = new BigInteger(64, new SecureRandom());
  builder.setNotValidAfter(ZonedDateTime.ofInstant(Instant.ofEpochMilli(to.getTime()), TimeZone.getDefault().toZoneId()));
  builder.setNotValidBefore(ZonedDateTime.ofInstant(Instant.ofEpochMilli(from.getTime()), TimeZone.getDefault().toZoneId()));
  builder.setSerialNumber(sn);
  X500Principal owner = new X500Principal("CN=" + autoGenerateCertHostName);
  builder.setSubjectDn(owner);
  builder.setIssuerDn(owner);
  builder.setPublicKey(pair.getPublic());
  builder.setVersion(3);
  builder.setSignatureAlgorithmName(SHA_256_WITH_RSA);
  builder.setSigningKey(privkey);
  return builder.build();
}
origin: org.wildfly/wildfly-testsuite-shared

  /**
   * Generates self-signed certificate for provided key-pair with given validity time and signature algorithm.
   *
   * @param name               common name for the certificate
   * @param keyPair            public and private keys
   * @param certValidity       how long the certificate should be valid to the future (number of seconds)
   * @param signatureAlgorithm signature algorithm
   * @return generated certificate
   * @throws CertificateException
   */
  public static X509Certificate generateX509Certificate(String name, KeyPair keyPair, long certValidity, String
      signatureAlgorithm) throws CertificateException {
    ZonedDateTime from = ZonedDateTime.now();
    ZonedDateTime to = ZonedDateTime.now().plusSeconds(certValidity);
    BigInteger serialNumber = new BigInteger(64, new SecureRandom());
    X500Principal owner = new X500Principal("CN=" + name);

    X509CertificateBuilder certificateBuilder = new X509CertificateBuilder();
    return certificateBuilder.setIssuerDn(owner).setSubjectDn(owner).setNotValidBefore(from).setNotValidAfter(to)
        .setSerialNumber(serialNumber).setPublicKey(keyPair.getPublic()).setSignatureAlgorithmName
            (signatureAlgorithm).setSigningKey(keyPair.getPrivate()).build();
  }
}
origin: org.wildfly.security/wildfly-elytron

certificateBuilder.setNotValidAfter(notValidAfter);
origin: org.wildfly.security/wildfly-elytron-x500-cert

certificateBuilder.setNotValidAfter(notValidAfter);
origin: org.jboss.eap/wildfly-client-all

certificateBuilder.setNotValidAfter(notValidAfter);
org.wildfly.security.x500.certX509CertificateBuildersetNotValidAfter

Javadoc

Set the not-valid-after date.

Popular methods of X509CertificateBuilder

  • <init>
    Construct a new uninitialized instance.
  • build
    Attempt to construct and sign an X.509 certificate according to the information in this builder.
  • setIssuerDn
    Set the issuer DN.
  • setNotValidBefore
    Set the not-valid-before date.
  • setPublicKey
    Set the public key.
  • setSerialNumber
    Set the serial number of the certificate being built. The serial number must be positive and no larg
  • setSignatureAlgorithmName
    Set the signature algorithm name.
  • setSigningKey
    Set the signing key.
  • setSubjectDn
    Set the subject DN.
  • setVersion
    Set the certificate version.
  • addExtension
    Add a certificate extension. If an extension with the same OID already exists, an exception is throw
  • getTBSBytes
  • addExtension,
  • getTBSBytes

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • onRequestPermissionsResult (Fragment)
  • getSharedPreferences (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JFrame (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now