Examples of DEROutputStream


Examples of com.maverick.crypto.asn1.DEROutputStream

    public byte[] getTBSCertificate()
        throws CertificateException
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);

        try
        {
            dOut.writeObject(c.getTBSCertificate());

            return bOut.toByteArray();
        }
        catch (IOException e)
        {
View Full Code Here

Examples of com.maverick.crypto.asn1.DEROutputStream

        if (c.getSignatureAlgorithm().getParameters() != null)
        {
            try
            {
                DEROutputStream         dOut = new DEROutputStream(bOut);

                dOut.writeObject(c.getSignatureAlgorithm().getParameters());
            }
            catch (Exception e)
            {
                throw new RuntimeException("exception getting sig parameters " + e);
            }
View Full Code Here

Examples of com.maverick.crypto.asn1.DEROutputStream

            X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));

            if (ext != null)
            {
                ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
                DEROutputStream            dOut = new DEROutputStream(bOut);

                try
                {
                    dOut.writeObject(ext.getValue());

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

Examples of com.maverick.crypto.asn1.DEROutputStream

    public byte[] getEncoded()
        throws CertificateException
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);

        try
        {
            dOut.writeObject(c);

            return bOut.toByteArray();
        }
        catch (IOException e)
        {
View Full Code Here

Examples of com.zaranux.client.crypto.DerOutputStream

     * @exception InvalidKeyException if an encoding error occurs.
     */
    public byte[] encode() throws InvalidKeyException {
        if (encodedKey == null) {
            try {
                DerOutputStream out;

                out = new DerOutputStream ();
                encode (out);
                encodedKey = out.toByteArray();

            } catch (IOException e) {
                throw new InvalidKeyException ("IOException : " +
                                               e.getMessage());
            }
View Full Code Here

Examples of jcifs.spnego.asn1.DEROutputStream

    }

    public byte[] toByteArray() {
        try {
            ByteArrayOutputStream collector = new ByteArrayOutputStream();
            DEROutputStream der = new DEROutputStream(collector);
            ASN1EncodableVector fields = new ASN1EncodableVector();
            int result = getResult();
            if (result != UNSPECIFIED_RESULT) {
                fields.add(new DERTaggedObject(true, 0,
                        new DEREnumerated(result)));
            }
            String mechanism = getMechanism();
            if (mechanism != null) {
                fields.add(new DERTaggedObject(true, 1,
                        new DERObjectIdentifier(mechanism)));
            }
            byte[] mechanismToken = getMechanismToken();
            if (mechanismToken != null) {
                fields.add(new DERTaggedObject(true, 2,
                        new DEROctetString(mechanismToken)));
            }
            byte[] mechanismListMIC = getMechanismListMIC();
            if (mechanismListMIC != null) {
                fields.add(new DERTaggedObject(true, 3,
                        new DEROctetString(mechanismListMIC)));
            }
            der.writeObject(new DERTaggedObject(true, 1,
                    new DERSequence(fields)));
            return collector.toByteArray();
        } catch (IOException ex) {
            throw new IllegalStateException(ex.getMessage());
        }
View Full Code Here

Examples of jcifs.spnego.asn1.DEROutputStream

    }

    public byte[] toByteArray() {
        try {
            ByteArrayOutputStream collector = new ByteArrayOutputStream();
            DEROutputStream der = new DEROutputStream(collector);
            der.writeObject(new DERObjectIdentifier(
                    SpnegoConstants.SPNEGO_MECHANISM));
            ASN1EncodableVector fields = new ASN1EncodableVector();
            String[] mechanisms = getMechanisms();
            if (mechanisms != null) {
                ASN1EncodableVector vector = new ASN1EncodableVector();
                for (int i = 0; i < mechanisms.length; i++) {
                    vector.add(new DERObjectIdentifier(mechanisms[i]));
                }
                fields.add(new DERTaggedObject(true, 0,
                        new DERSequence(vector)));
            }
            int contextFlags = getContextFlags();
            if (contextFlags != 0) {
                fields.add(new DERTaggedObject(true, 1,
                        new DERBitString(contextFlags)));
            }
            byte[] mechanismToken = getMechanismToken();
            if (mechanismToken != null) {
                fields.add(new DERTaggedObject(true, 2,
                        new DEROctetString(mechanismToken)));
            }
            byte[] mechanismListMIC = getMechanismListMIC();
            if (mechanismListMIC != null) {
                fields.add(new DERTaggedObject(true, 3,
                        new DEROctetString(mechanismListMIC)));
            }
            der.writeObject(new DERTaggedObject(true, 0,
                        new DERSequence(fields)));
            DERObject token = new DERUnknownTag(DERTags.CONSTRUCTED |
                    DERTags.APPLICATION, collector.toByteArray());
            der = new DEROutputStream(collector = new ByteArrayOutputStream());
            der.writeObject(token);
            return collector.toByteArray();
        } catch (IOException ex) {
            throw new IllegalStateException(ex.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.geronimo.crypto.asn1.DEROutputStream

        if (!csr.verify()) {
            throw new KeyStoreException("CSR verification failed");
        }

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        DEROutputStream deros = new DEROutputStream(os);
        deros.writeObject(csr.getDERObject());
        String b64 = new String(Base64.encode(os.toByteArray()));

        final String BEGIN_CERT_REQ = "-----BEGIN CERTIFICATE REQUEST-----";
        final String END_CERT_REQ = "-----END CERTIFICATE REQUEST-----";
        final int CERT_REQ_LINE_LENGTH = 70;
View Full Code Here

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

        sig.initSign(signingKey);

        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);

            dOut.writeObject(reqInfo);

            sig.update(bOut.toByteArray());
        }
        catch (Exception e)
        {
View Full Code Here

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

        sig.initVerify(this.getPublicKey(provider));

        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);

            dOut.writeObject(reqInfo);

            sig.update(bOut.toByteArray());
        }
        catch (Exception e)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.