Package org.bouncycastle.asn1

Examples of org.bouncycastle.asn1.DERObject


        pkcs7input[20] = four;
        pkcs7input[21] = three;
        pkcs7input[22] = two;
        pkcs7input[23] = one;

        DERObject obj = createDERForRecipient(pkcs7input, (X509Certificate)certificate);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        DEROutputStream k = new DEROutputStream(baos);
View Full Code Here


        AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance(s);
        AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters();
        ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1"));
        ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream);
        DERObject derobject = asn1inputstream.readObject();
        KeyGenerator keygenerator = KeyGenerator.getInstance(s);
        keygenerator.init(128);
        SecretKey secretkey = keygenerator.generateKey();
        Cipher cipher = Cipher.getInstance(s);
        cipher.init(1, secretkey, algorithmparameters);
View Full Code Here

            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(contentsKey));

            //
            // Basic checks to make sure it's a PKCS#7 SignedData Object
            //
            DERObject pkcs;

            try {
                pkcs = din.readObject();
            }
            catch (IOException e) {
View Full Code Here

     * @throws CertificateParsingException on error
     * @since  2.1.6
     */
    public static String getOCSPURL(X509Certificate certificate) throws CertificateParsingException {
        try {
            DERObject obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId());
            if (obj == null) {
                return null;
            }

            ASN1Sequence AccessDescriptions = (ASN1Sequence) obj;
View Full Code Here

            log.debug("Privatekey : " + privateKey.getAlgorithm());
            decBytes = recipient.getContent(privateKey, jceProvider);
            break;
        }

        DERObject derobj = new ASN1InputStream(new ByteArrayInputStream(decBytes)).readObject();
        if (messageType == ScepRequestMessage.SCEP_TYPE_PKCSREQ) {
            ASN1Sequence seq = (ASN1Sequence) derobj;
            pkcs10 = new PKCS10CertificationRequest(seq);
            if (log.isDebugEnabled()) {
              log.debug("Successfully extracted PKCS10:"+new String(Base64.encode(pkcs10.getEncoded())));
View Full Code Here

          if (crlExt != null) {
            X509Extension ext = crlExt.getExtension(X509Extensions.ReasonCode);
            if (ext != null) {
              try {
                ASN1InputStream ai = new ASN1InputStream(ext.getValue().getOctets());
                DERObject obj = ai.readObject();
                DEREnumerated crlreason = DEREnumerated.getInstance(obj);
                // RevokedCertInfo.REVOCATION_REASON_AACOMPROMISE are the same integer values as the CRL reason extension code
                reason = crlreason.getValue().intValue();
                LOG.debug("CRLReason extension: "+reason);
              } catch (IOException e) {
View Full Code Here

                        X509Extension ext = exts.getExtension(X509Extensions.KeyUsage);
                        if (ext != null) {
                          ASN1OctetString os = ext.getValue();
                          ByteArrayInputStream bIs = new ByteArrayInputStream(os.getOctets());
                          ASN1InputStream dIs = new ASN1InputStream(bIs);
                          DERObject dob = dIs.readObject();
                          DERBitString bs = DERBitString.getInstance(dob);
                          keyusage = bs.intValue();                                                           
                          if (log.isDebugEnabled()) {
                            log.debug("We have a key usage request extension: "+keyusage);
                          }
View Full Code Here

  // convert PKCS#8 format to PKCS#1.
  private byte[] convert8to1(byte[] data) throws Exception {
    log.debug("SOTProxyCreateServlet::convert8to1() start.");

    DERObject keyInfo = SOTSignOnToolUtil.toDERObject(data);
    PrivateKeyInfo pkey = new PrivateKeyInfo(
        (DERConstructedSequence) keyInfo);
    // new PrivateKeyInfo((DERSequence)keyInfo);
    DERObject derKey = pkey.getPrivateKey();

    return SOTSignOnToolUtil.toByteArray(derKey);
  }
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    private static TBSCertificateStructure getTBSCertificate(X509Certificate cert) throws GeneralSecurityException {
        DERObject derObject = toDer(cert.getTBSCertificate());
        return TBSCertificateStructure.getInstance(derObject);
    }
View Full Code Here

        // default for ordering
        ordering = new DERBoolean(false);
       
        while (e.hasMoreElements())
        {
            DERObject o = (DERObject) e.nextElement();

            if (o instanceof ASN1TaggedObject)
            {
                DERTaggedObject tagged = (DERTaggedObject) o;
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.DERObject

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.