Package org.apache.xml.security.stax.impl.util

Examples of org.apache.xml.security.stax.impl.util.UnsynchronizedByteArrayInputStream


                            }

                            @Override
                            public void doFinal() throws XMLStreamException {
                                xmlEventWriter.close();
                                getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
                                getTransformer().doFinal();
                            }
                        };
                        break;
                    }
View Full Code Here


    @Override
    public void doFinal() throws XMLStreamException {
        if (getTransformer() != null) {
            UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
            getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
            getTransformer().doFinal();
        }
    }
View Full Code Here

     * @return An X509 certificate
     * @throws XMLSecurityException
     */
    private static X509Certificate getCertificateFromBytes(byte[] data)
            throws XMLSecurityException {
        InputStream in = new UnsynchronizedByteArrayInputStream(data);
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            return (X509Certificate) factory.generateCertificate(in);
        } catch (CertificateException e) {
            throw new XMLSecurityException(e);
View Full Code Here

            byte[] binaryContent, String id, WSSSecurityProperties securityProperties) throws XMLSecurityException {

        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id,
                WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier, securityProperties, true);

        X509Certificate x509Certificate = getCrypto().loadCertificate(new UnsynchronizedByteArrayInputStream(binaryContent));
        setX509Certificates(new X509Certificate[]{x509Certificate});

        // Check to see if the certificates actually correspond to the decryption crypto
        if (getCrypto().getX509Identifier(getX509Certificates()[0]) == null) {
            try {
View Full Code Here

            WSSSecurityProperties securityProperties) throws XMLSecurityException {

        super(WSSecurityTokenConstants.X509PkiPathV1Token, wsInboundSecurityContext, crypto,
                callbackHandler, id, keyIdentifier, securityProperties, true);

        InputStream in = new UnsynchronizedByteArrayInputStream(binaryContent);
        try {
            CertPath certPath = getCrypto().getCertificateFactory().generateCertPath(in);
            List<? extends Certificate> l = certPath.getCertificates();
            X509Certificate[] certs = new X509Certificate[l.size()];
            Iterator<? extends Certificate> iterator = l.iterator();
View Full Code Here

    @Override
    public void doFinal() throws XMLStreamException {
        if (getTransformer() != null) {
            UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
            getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
            getTransformer().doFinal();
        }
    }
View Full Code Here

     * @return An X509 certificate
     * @throws XMLSecurityException
     */
    private static X509Certificate getCertificateFromBytes(byte[] data)
            throws XMLSecurityException {
        InputStream in = new UnsynchronizedByteArrayInputStream(data);
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            return (X509Certificate) factory.generateCertificate(in);
        } catch (CertificateException e) {
            throw new XMLSecurityException(e);
View Full Code Here

     * @return An X509 certificate
     * @throws XMLSecurityException
     */
    private static X509Certificate getCertificateFromBytes(byte[] data)
            throws XMLSecurityException {
        InputStream in = new UnsynchronizedByteArrayInputStream(data);
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            return (X509Certificate) factory.generateCertificate(in);
        } catch (CertificateException e) {
            throw new XMLSecurityException(e);
View Full Code Here

                            }

                            @Override
                            public void doFinal() throws XMLStreamException {
                                xmlEventWriter.close();
                                getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
                                getTransformer().doFinal();
                            }
                        };
                        break;
                    }
View Full Code Here

                                            throw new XMLStreamException(e);
                                        }
                                        XMLEventReaderInputProcessor xmlEventReaderInputProcessor
                                                = new XMLEventReaderInputProcessor(
                                                null,
                                                getXmlInputFactory().createXMLStreamReader(new UnsynchronizedByteArrayInputStream(byteArrayOutputStream.toByteArray()))
                                        );

                                        try {
                                            XMLSecEvent xmlSecEvent;
                                            do {
                                                xmlSecEvent = xmlEventReaderInputProcessor.processNextEvent(null);
                                                getTransformer().transform(xmlSecEvent);
                                            } while (xmlSecEvent.getEventType() != XMLStreamConstants.END_DOCUMENT);
                                        } catch (XMLSecurityException e) {
                                            throw new XMLStreamException(e);
                                        }
                                        getTransformer().doFinal();
                                    }
                                };
                                break;
                            }
                            case InputStream: {
                                childOutputMethod = new ChildOutputMethod() {

                                    private UnsynchronizedByteArrayOutputStream byteArrayOutputStream;
                                    private Base64OutputStream base64OutputStream;

                                    @Override
                                    public void transform(Object object) throws XMLStreamException {
                                        if (base64OutputStream == null) {
                                            byteArrayOutputStream = new UnsynchronizedByteArrayOutputStream();
                                            base64OutputStream = new Base64OutputStream(byteArrayOutputStream, false);
                                        }
                                        try {
                                            base64OutputStream.write(((byte[]) object));
                                        } catch (IOException e) {
                                            throw new XMLStreamException(e);
                                        }
                                    }

                                    @Override
                                    public void doFinal() throws XMLStreamException {
                                        try {
                                            base64OutputStream.close();
                                        } catch (IOException e) {
                                            throw new XMLStreamException(e);
                                        }
                                        getTransformer().transform(new UnsynchronizedByteArrayInputStream(byteArrayOutputStream.toByteArray()));
                                        getTransformer().doFinal();
                                    }
                                };
                                break;
                            }
View Full Code Here

TOP

Related Classes of org.apache.xml.security.stax.impl.util.UnsynchronizedByteArrayInputStream

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.