Package org.bouncycastle.asn1.x500

Examples of org.bouncycastle.asn1.x500.X500Name


            throw new RuntimeException("X.509 CRL used with non X.509 Cert");
        }

        TBSCertList.CRLEntry[] certs = c.getRevokedCertificates();

        X500Name caName = c.getIssuer();

        if (certs != null)
        {
            BigInteger serial = ((X509Certificate)cert).getSerialNumber();

            for (int i = 0; i < certs.length; i++)
            {
                if (isIndirect && certs[i].hasExtensions())
                {
                    Extension currentCaName = certs[i].getExtensions().getExtension(Extension.certificateIssuer);

                    if (currentCaName != null)
                    {
                        caName = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
                    }
                }

                if (certs[i].getUserCertificate().getValue().equals(serial))
                {
                    X500Name issuer;

                    if (cert instanceof  X509Certificate)
                    {
                        issuer = X500Name.getInstance(((X509Certificate)cert).getIssuerX500Principal().getEncoded());
                    }
View Full Code Here


    private Set loadCRLEntries()
    {
        Set entrySet = new HashSet();
        Enumeration certs = c.getRevokedCertificateEnumeration();

        X500Name previousCertificateIssuer = null; // the issuer
        while (certs.hasMoreElements())
        {
            TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry)certs.nextElement();
            X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
            entrySet.add(crlEntry);
View Full Code Here

    public X509CRLEntry getRevokedCertificate(BigInteger serialNumber)
    {
        Enumeration certs = c.getRevokedCertificateEnumeration();

        X500Name previousCertificateIssuer = null; // the issuer
        while (certs.hasMoreElements())
        {
            TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry)certs.nextElement();

            if (serialNumber.equals(entry.getUserCertificate().getValue()))
View Full Code Here

            throw new RuntimeException("X.509 CRL used with non X.509 Cert");
        }

        TBSCertList.CRLEntry[] certs = c.getRevokedCertificates();

        X500Name caName = c.getIssuer();

        if (certs != null)
        {
            BigInteger serial = ((X509Certificate)cert).getSerialNumber();

            for (int i = 0; i < certs.length; i++)
            {
                if (isIndirect && certs[i].hasExtensions())
                {
                    Extension currentCaName = certs[i].getExtensions().getExtension(Extension.certificateIssuer);

                    if (currentCaName != null)
                    {
                        caName = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
                    }
                }

                if (certs[i].getUserCertificate().getValue().equals(serial))
                {
                    X500Name issuer;

                    if (cert instanceof  X509Certificate)
                    {
                        issuer = X500Name.getInstance(((X509Certificate)cert).getIssuerX500Principal().getEncoded());
                    }
View Full Code Here

    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.YEAR, 100);

    BigInteger serialNumber = BigInteger.valueOf((startDate.getTimeInMillis()));
    X500Name issuer = new X500Name(IETFUtils.rDNsFromString(issuerDirString, RFC4519Style.INSTANCE));
    JcaX509v3CertificateBuilder certGen = new JcaX509v3CertificateBuilder(issuer, serialNumber, startDate.getTime(), endDate.getTime(), issuer, kp.getPublic());
    JcaX509ExtensionUtils extensionUtils = new JcaX509ExtensionUtils();
    certGen.addExtension(Extension.subjectKeyIdentifier, false, extensionUtils.createSubjectKeyIdentifier(kp.getPublic()));
    certGen.addExtension(Extension.basicConstraints, false, new BasicConstraints(isCertAuthority));
    certGen.addExtension(Extension.authorityKeyIdentifier, false, extensionUtils.createAuthorityKeyIdentifier(signerPublicKey));
View Full Code Here

   * @throws CertificateEncodingException
   */
  public String getUserCertificateCN()
     throws CertificateEncodingException
  {
    X500Name x500name = new JcaX509CertificateHolder(userCertificate).getSubject();
    RDN cn = x500name.getRDNs(BCStyle.CN)[0];

    return IETFUtils.valueToString(cn.getFirst().getValue());
  }
View Full Code Here

   * @throws CertificateEncodingException
   */
  public String getUserCertificateOrg()
     throws CertificateEncodingException
  {
    X500Name x500name = new JcaX509CertificateHolder(userCertificate).getSubject();
    RDN org = x500name.getRDNs(BCStyle.O)[0];

    return IETFUtils.valueToString(org.getFirst().getValue());
  }
View Full Code Here

  KeyPair pair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
  TransactionId transId = TransactionId.createTransactionId();
  Nonce recipientNonce = Nonce.nextNonce();
  Nonce senderNonce = recipientNonce;
  X500Name issuer = new X500Name("CN=CA");
  X500Name subject = new X500Name("CN=Client");
  IssuerAndSubject ias = new IssuerAndSubject(issuer, subject);
  BigInteger serial = BigInteger.ONE;
  IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(issuer, serial);
  PKCS10CertificationRequest csr = getCsr(new X500Principal("CN=Client"),
    pair.getPublic(), pair.getPrivate(), "password".toCharArray());
View Full Code Here

  LOGGER.debug("INIT");
    }

    @Override
    public void init() throws ServletException {
  name = new X500Name("CN=Certification Authority");
  pollName = new X500Name("CN=Poll");
  caSerial = BigInteger.TEN;
  try {
      KeyPair keyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
      priKey = keyPair.getPrivate();
      pubKey = keyPair.getPublic();
View Full Code Here

    @Override
    protected List<X509Certificate> doEnrol(PKCS10CertificationRequest csr,
      TransactionId transId) throws OperationFailureException {
  try {
      X500Name subject = X500Name.getInstance(csr.getSubject());
      LOGGER.debug(subject.toString());
      if (subject.equals(pollName)) {
    return Collections.emptyList();
      }
      String password = getPassword(csr);
      if (!password.equals("password")) {
    LOGGER.debug("Invalid password");
View Full Code Here

TOP

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

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.