Package org.bouncycastle.asn1.x500

Examples of org.bouncycastle.asn1.x500.RDN


    builder.addRDN(BCStyle.CN, value);
    return builder.build();
  }

  public static X500Name toX500Name(final X500Principal principal) {
    X500Name x500Name = new X500Name(principal.getName());
    return x500Name;
  }
View Full Code Here


  }

  public static X500Principal toX500Principal(final String value) throws IOException {
    X500NameBuilder builder = new X500NameBuilder(BCStyle.INSTANCE);
    builder.addRDN(BCStyle.CN, value);
    X500Name name = builder.build();
    return BouncyCastleProviderHelper.toX500Principal(name);
  }
View Full Code Here

   
    BigInteger serial = new BigInteger(snBytes).abs();
   
    X500NameBuilder nameBuilder = new X500NameBuilder(BCStyle.INSTANCE);
    nameBuilder.addRDN(BCStyle.CN, "NVIDIA GameStream Client");
    X500Name name = nameBuilder.build();
   
    X509v3CertificateBuilder certBuilder = new X509v3CertificateBuilder(name, serial, now, expirationDate, Locale.ENGLISH, name,
        SubjectPublicKeyInfo.getInstance(keyPair.getPublic().getEncoded()));

    try {
View Full Code Here

    try {
      KeyStore userKeyStore = UserConfig.getUserKeyStore();
      X509Certificate currentCertificate = (X509Certificate) userKeyStore.getCertificate(CipherParams.CERTIFICATE_IDENTIFIER);
     
      if (currentCertificate != null) {
        X500Name currentCertificateSubject = new JcaX509CertificateHolder(currentCertificate).getSubject();
        RDN currentCertificateSubjectCN = currentCertificateSubject.getRDNs(BCStyle.CN)[0];

        String currentCertificateSubjectCnStr = IETFUtils.valueToString(currentCertificateSubjectCN.getFirst().getValue());
       
        if (!certificateCommonName.equals(currentCertificateSubjectCnStr)) {
          logger.log(Level.INFO, "- Certificate regeneration necessary: Cert common name in daemon config changed from " + currentCertificateSubjectCnStr + " to " + certificateCommonName + ".");
View Full Code Here

    Date notBefore = new Date(System.currentTimeMillis() - 1*24*60*60*1000L);
    Date notAfter = new Date(System.currentTimeMillis() + 5*365*24*60*60*1000L);
    BigInteger serial = BigInteger.valueOf(System.currentTimeMillis());

    // Issuer and subject (identical, because self-signed)
    X500Name issuer = builder.build();
    X500Name subject = issuer;
   
    X509v3CertificateBuilder certificateGenerator =
      new JcaX509v3CertificateBuilder(issuer, serial, notBefore, notAfter, subject, keyPair.getPublic());
   
    ContentSigner signatureGenerator = new JcaContentSignerBuilder("SHA256WithRSAEncryption")
View Full Code Here

    converter.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
    return converter.getCertificate(holder);
  }

  public static String getName(final X500Principal principal) {
    X500Name x500Name = new X500Name(principal.getName());
    return BouncyCastleProviderHelper.getName(x500Name);
  }
View Full Code Here

    X500Name x500Name = new X500Name(principal.getName());
    return BouncyCastleProviderHelper.getName(x500Name);
  }

  public static String getName(final X509Principal principal) {
    X500Name x500Name = new X500Name(principal.getName());
    return BouncyCastleProviderHelper.getName(x500Name);
  }
View Full Code Here

  }

  public static X500Principal toX500Principal(final String value) throws IOException {
    X500NameBuilder builder = new X500NameBuilder(BCStyle.INSTANCE);
    builder.addRDN(BCStyle.CN, value);
    X500Name name = builder.build();
    return BouncyCastleProviderHelper.toX500Principal(name);
  }
View Full Code Here

      // =(PKCS12BagAttributeCarrier) kp.getPrivate();
      // bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_localKeyId,
      // new SubjectKeyIdentifier(kp.getPublic().getEncoded()));

      // build the X500 name
      final X500NameBuilder builder = new X500NameBuilder(
          BCStyle.INSTANCE);
      builder.addRDN(BCStyle.C, countryCode);
      builder.addRDN(BCStyle.O, organizationName);
      builder.addRDN(BCStyle.OU, organizationName);
      builder.addRDN(BCStyle.L, localityName);
      builder.addRDN(BCStyle.ST, state);
      builder.addRDN(BCStyle.E, emailAddress);
      builder.addRDN(BCStyle.CN, commonName);

      final ContentSigner sigGen = new JcaContentSignerBuilder(sa.name())
          .setProvider(BouncyCastleProvider.PROVIDER_NAME).build(
              kp.getPrivate());
      // JcaX509v3CertificateBuilder parameters:
      // issuer X500Name representing the issuer of this certificate.
      // serial the serial number for the certificate.
      // notBefore date before which the certificate is not valid.
      // notAfter date after which the certificate is not valid.
      // subject X500Name representing the subject of this certificate.
      // publicKey the public key to be associated with the certificate.
      final X509v3CertificateBuilder certGen = new JcaX509v3CertificateBuilder(
          builder.build(),
          generateSerialNumber(BigInteger.valueOf(KEY_SIZE)),
          calBegin.getTime(), calEnd.getTime(), builder.build(),
          kp.getPublic());
      certGen.addExtension(X509Extension.subjectKeyIdentifier, false,
          new SubjectKeyIdentifier(kp.getPublic().getEncoded()));
      certGen.addExtension(X509Extension.basicConstraints, false,
          new BasicConstraints(0));
View Full Code Here

    ASN1Sequence sequence = (ASN1Sequence) BouncyCastleProviderHelper.toASN1Primitive(bytes);
    return sequence;
  }

  public static X500Name toX500Name(final String value) {
    X500NameBuilder builder = new X500NameBuilder(BCStyle.INSTANCE);
    builder.addRDN(BCStyle.CN, value);
    return builder.build();
  }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.x500.RDN

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.