Package org.bouncycastle.asn1.x500

Examples of org.bouncycastle.asn1.x500.DirectoryString


        super();
        this.csr = csr;
    }

    public static Csr buildCsr(KeyPair keyPair, X500Principal subjectName) {
        X500Name subject = BouncyCastleHelpers.toX500Name(subjectName);
        SubjectPublicKeyInfo publicKeyInfo = BouncyCastleHelpers.toSubjectPublicKeyInfo(keyPair.getPublic());
        PKCS10CertificationRequestBuilder csrBuilder = new PKCS10CertificationRequestBuilder(subject, publicKeyInfo);

        AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA1withRSA");
        AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);
View Full Code Here


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

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

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

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

    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

        } catch (IOException e) {
            throw new InvalidKeyException("Can not parse the public key"
                    + "being included in the short lived certificate", e);
        }

        X500Name issuerX500Name = CertificateHelpers.toX500Name(caCred.getCertificate().getSubjectX500Principal());

        X500Name subjectX500Name = CertificateHelpers.toX500Name(subjectDN);

        X509v3CertificateBuilder certBuilder = new X509v3CertificateBuilder(issuerX500Name, new BigInteger(20, rand),
                new Date(startTime), new Date(endTime), subjectX500Name, publicKeyInfo);

        AlgorithmIdentifier sigAlgId = X509v3CertificateBuilder.extractAlgorithmId(caCred.getCertificate());
View Full Code Here

    setOID(dnBuilder, metadata, "L", null);
    setOID(dnBuilder, metadata, "O", Constants.NAME);
    setOID(dnBuilder, metadata, "OU", Constants.NAME);
    setOID(dnBuilder, metadata, "E", metadata.emailAddress);
    setOID(dnBuilder, metadata, "CN", metadata.commonName);
    X500Name dn = dnBuilder.build();
    return dn;
  }
View Full Code Here

   */
  public static X509Certificate newSSLCertificate(X509Metadata sslMetadata, PrivateKey caPrivateKey, X509Certificate caCert, File targetStoreFile, X509Log x509log) {
    try {
      KeyPair pair = newKeyPair();

      X500Name webDN = buildDistinguishedName(sslMetadata);
      X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(caCert).getName());

      X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(
          issuerDN,
          BigInteger.valueOf(System.currentTimeMillis()),
          sslMetadata.notBefore,
View Full Code Here

      ContentSigner caSigner = new JcaContentSignerBuilder(SIGNING_ALGORITHM).setProvider(BC).build(caPair.getPrivate());

      // clone metadata
      X509Metadata caMetadata = metadata.clone(CA_CN, metadata.password);
      X500Name issuerDN = buildDistinguishedName(caMetadata);

      // Generate self-signed certificate
      X509v3CertificateBuilder caBuilder = new JcaX509v3CertificateBuilder(
          issuerDN,
          BigInteger.valueOf(System.currentTimeMillis()),
View Full Code Here

      // read the Gitblit CA key and certificate
      KeyStore store = openKeyStore(caKeystoreFile, caKeystorePassword);
      PrivateKey caPrivateKey = (PrivateKey) store.getKey(CA_ALIAS, caKeystorePassword.toCharArray());
      X509Certificate caCert = (X509Certificate) store.getCertificate(CA_ALIAS);

      X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(caCert).getName());
      X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date());

      // build and sign CRL with CA private key
      ContentSigner signer = new JcaContentSignerBuilder(SIGNING_ALGORITHM).setProvider(BC).build(caPrivateKey);
      X509CRLHolder crl = crlBuilder.build(signer);
View Full Code Here

TOP

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

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.