Package org.bouncycastle.asn1.x509

Examples of org.bouncycastle.asn1.x509.AttributeCertificateInfo


     *
     * @return a PKCS8 representation of the key.
     */
    public byte[] getEncoded()
    {
        return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(getX()));
    }
View Full Code Here


        if (!extGenerator.isEmpty())
        {
            acInfoGen.setExtensions(extGenerator.generate());
        }

        AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(acInfo);
        v.add(sigAlgId);
View Full Code Here

        if (!extGenerator.isEmpty())
        {
            acInfoGen.setExtensions(extGenerator.generate());
        }

        AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(acInfo);
        v.add(sigAlgId);
View Full Code Here

        if (extensions != null)
        {
            acInfoGen.setExtensions(new X509Extensions(extOrdering, extensions));
        }

        AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);
View Full Code Here

            ASN1Sequence seq = (ASN1Sequence) aIn.readObject();
            dump = ASN1Dump.dumpAsString(seq);

            AttributeCertificate obj = new AttributeCertificate(seq);
            AttributeCertificateInfo acInfo = obj.getAcinfo();

            // Version
            if (!(acInfo.getVersion().equals(new DERInteger(1)))
                    && (!(acInfo.getVersion().equals(new DERInteger(2)))))
            {
                return new SimpleTestResult(false,
                        "failed AC Version test for id " + id);
            }

            // Holder
            Holder h = acInfo.getHolder();
            if (h == null)
            {
                return new SimpleTestResult(false,
                        "failed AC Holder test, it's null, for id " + id);
            }

            // Issuer
            AttCertIssuer aci = acInfo.getIssuer();
            if (aci == null)
            {
                return new SimpleTestResult(false,
                        "failed AC Issuer test, it's null, for id " + id);
            }

            // Signature
            AlgorithmIdentifier sig = acInfo.getSignature();
            if (sig == null)
            {
                return new SimpleTestResult(false,
                        "failed AC Signature test for id " + id);
            }

            // Serial
            DERInteger serial = acInfo.getSerialNumber();

            // Validity
            AttCertValidityPeriod validity = acInfo.getAttrCertValidityPeriod();
            if (validity == null)
            {
                return new SimpleTestResult(false,
                        "failed AC AttCertValidityPeriod test for id " + id);
            }

            // Attributes
            ASN1Sequence attribSeq = acInfo.getAttributes();
            Attribute att[] = new Attribute[attribSeq.size()];
            for (int i = 0; i < attribSeq.size(); i++)
            {
                att[i] = Attribute.getInstance(attribSeq.getObjectAt(i));
            }

            // IssuerUniqueId
            // TODO, how to best test?

            // X509 Extensions
            X509Extensions ext = acInfo.getExtensions();
            if (ext != null)
            {
                Enumeration en = ext.oids();
                while (en.hasMoreElements())
                {
View Full Code Here

        if (!extGenerator.isEmpty())
        {
            acInfoGen.setExtensions(extGenerator.generate());
        }

        AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(acInfo);
        v.add(sigAlgId);
View Full Code Here

                    buf.append("                       critical(" + ext.isCritical() + ") ");
                    try
                    {
                        if (oid.equals(X509Extensions.BasicConstraints))
                        {
                            buf.append(new BasicConstraints((ASN1Sequence)dIn.readObject()) + nl);
                        }
                        else if (oid.equals(X509Extensions.KeyUsage))
                        {
                            buf.append(new KeyUsage((DERBitString)dIn.readObject()) + nl);
                        }
View Full Code Here

      AsymmetricKeyParameter caPrivateKeyParameters = PrivateKeyFactory.createKey(signerPrivateKey.getEncoded());
      ContentSigner contentSigner = new BcRSAContentSignerBuilder(sigAlgId, digestAlgId)
          .build(caPrivateKeyParameters);

      X509CertificateHolder certificateHolder = certificateBuilder.build(contentSigner);
      Certificate certificate = certificateHolder.toASN1Structure();

      return certificate;
    } catch (OperatorCreationException e) {
      throw new OpsException("Error signing certificate", e);
    } catch (IOException e) {
View Full Code Here

  }

  public X509Certificate signCsr(PKCS10CertificationRequest csr) throws OpsException {
    SubjectPublicKeyInfo subjectPublicKeyInfo = csr.getSubjectPublicKeyInfo();
    X500Name subject = csr.getSubject();
    Certificate certificate = signCertificate(
        BouncyCastleHelpers.toX500Name(caCertificate[0].getSubjectX500Principal()), caPrivateKey, subject,
        subjectPublicKeyInfo);
    return toX509(certificate);
  }
View Full Code Here

  // }
  // }

  public static X509Certificate signAsCa(X500Principal subject, PublicKey subjectPublicKey, X500Principal issuer,
      PrivateKey issuerPrivateKey) throws OpsException {
    Certificate certificate = signCertificate(BouncyCastleHelpers.toX500Name(issuer), issuerPrivateKey,
        BouncyCastleHelpers.toX500Name(subject), BouncyCastleHelpers.toSubjectPublicKeyInfo(subjectPublicKey));
    return toX509(certificate);
  }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.x509.AttributeCertificateInfo

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.