Package org.apache.geronimo.util.asn1

Examples of org.apache.geronimo.util.asn1.ASN1OutputStream


           
            ContentInfo     info = ContentInfo.getInstance(aIn.readObject());
            SignedData      sData = SignedData.getInstance(info.getContent());
           
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
           
            sData = new SignedData(sData.getDigestAlgorithms(), sData.getEncapContentInfo(), sData.getCertificates(), sData.getCRLs(), sData.getSignerInfos());
            info = new ContentInfo(CMSObjectIdentifiers.signedData, sData);
           
            aOut.writeObject(info);
           
            if (!isSameAs(bOut.toByteArray(), signedData))
            {
                return new SimpleTestResult(false, getName() + ": CMS signed failed to re-encode");
            }
View Full Code Here


           
            gen.setSubjectPublicKeyInfo(info);
           
            TBSCertificateStructure     tbs = gen.generateTBSCertificate();
            ByteArrayOutputStream       bOut = new ByteArrayOutputStream();
            ASN1OutputStream            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(tbs);
           
            if (!isSameAs(bOut.toByteArray(), v1Cert))
            {
                return new SimpleTestResult(false, getName() + ": failed v1 cert generation");
            }
           
            //
            // read back test
            //
            ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(v2CertList));
            DERObject       o = aIn.readObject();
           
            bOut = new ByteArrayOutputStream();
            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(o);
           
            if (!isSameAs(bOut.toByteArray(), v2CertList))
            {
                return new SimpleTestResult(false, getName() + ": failed v1 cert read back test");
            }
View Full Code Here

           
            gen.setExtensions(ex);
           
            TBSCertificateStructure     tbs = gen.generateTBSCertificate();
            ByteArrayOutputStream       bOut = new ByteArrayOutputStream();
            ASN1OutputStream            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(tbs);
           
            if (!isSameAs(bOut.toByteArray(), v3Cert))
            {
                return new SimpleTestResult(false, getName() + ": failed v3 cert generation");
            }
           
            //
            // read back test
            //
            ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(v2CertList));
            DERObject       o = aIn.readObject();
           
            bOut = new ByteArrayOutputStream();
            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(o);
           
            if (!isSameAs(bOut.toByteArray(), v2CertList))
            {
                return new SimpleTestResult(false, getName() + ": failed v3 cert read back test");
            }
View Full Code Here

           
            gen.setExtensions(ex);
           
            TBSCertList                 tbs = gen.generateTBSCertList();
            ByteArrayOutputStream       bOut = new ByteArrayOutputStream();
            ASN1OutputStream            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(tbs);
           
            if (!isSameAs(bOut.toByteArray(), v2CertList))
            {
                return new SimpleTestResult(false, getName() + ": failed v2 cert list generation");
            }
           
            //
            // read back test
            //
            ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(v2CertList));
            DERObject       o = aIn.readObject();
           
            bOut = new ByteArrayOutputStream();
            aOut = new ASN1OutputStream(bOut);
           
            aOut.writeObject(o);
           
            if (!isSameAs(bOut.toByteArray(), v2CertList))
            {
                return new SimpleTestResult(false, getName() + ": failed v2 cert list read back test");
            }
View Full Code Here

        byte[] data = Base64.decode("MA4ECAECAwQFBgcIAgIAgAMCBSAWBWhlbGxvMAoECAECAwQFBgcIFgtodHRwOi8vdGVzdA==");
       
        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
           
            for (int i = 0; i != values.length; i++)
            {
                aOut.writeObject(values[i]);
            }
           
            DERObject[] readValues = new DERObject[values.length];
           
            if (!isSameAs(bOut.toByteArray(), data))
View Full Code Here

        String  oid)
        throws IOException
    {
        DERObjectIdentifier     o = new DERObjectIdentifier(oid);
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
       
        aOut.writeObject(o);
       
        ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
        ASN1InputStream         aIn = new ASN1InputStream(bIn);
       
        o = (DERObjectIdentifier)aIn.readObject();
View Full Code Here

                digest = externalDigest;
            else
                digest = sig.sign();
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

            ASN1OutputStream dout = new ASN1OutputStream(bOut);
            dout.writeObject(new DEROctetString(digest));
            dout.close();

            return bOut.toByteArray();
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
View Full Code Here

            whole.add(new ASN1ObjectIdentifier(SecurityIDs.ID_PKCS7_SIGNED_DATA));
            whole.add(new DERTaggedObject(0, new DERSequence(body)));

            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

            ASN1OutputStream dout = new ASN1OutputStream(bOut);
            dout.writeObject(new DERSequence(whole));
            dout.close();

            return bOut.toByteArray();
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
View Full Code Here

                digest = externalDigest;
            else
                digest = sig.sign();
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

            ASN1OutputStream dout = new ASN1OutputStream(bOut);
            dout.writeObject(new DEROctetString(digest));
            dout.close();

            return bOut.toByteArray();
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
View Full Code Here

            whole.add(new DERObjectIdentifier(ID_PKCS7_SIGNED_DATA));
            whole.add(new DERTaggedObject(0, new DERSequence(body)));

            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

            ASN1OutputStream dout = new ASN1OutputStream(bOut);
            dout.writeObject(new DERSequence(whole));
            dout.close();

            return bOut.toByteArray();
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.util.asn1.ASN1OutputStream

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.