congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
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

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JCheckBox (javax.swing)
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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