congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
X509CertificateBuilder.setNotValidBefore
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: wildfly/wildfly

certificateBuilder.setNotValidBefore(notValidBefore);
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.setNotValidBefore(notValidBefore);
origin: org.wildfly.security/wildfly-elytron-x500-cert

certificateBuilder.setNotValidBefore(notValidBefore);
origin: org.jboss.eap/wildfly-client-all

certificateBuilder.setNotValidBefore(notValidBefore);
org.wildfly.security.x500.certX509CertificateBuildersetNotValidBefore

Javadoc

Set the not-valid-before 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.
  • setNotValidAfter
    Set the not-valid-after 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

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Top 12 Jupyter Notebook extensions
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