Package com.adito.security.pki

Examples of com.adito.security.pki.SimpleASNWriter


            }

            // Using a SimpleASNWriter
            ByteArrayOutputStream r = new ByteArrayOutputStream();
            ByteArrayOutputStream s = new ByteArrayOutputStream();
            SimpleASNWriter asn = new SimpleASNWriter();
            asn.writeByte(0x02);

            if (((signature[0] & 0x80) == 0x80) && (signature[0] != 0x00)) {
                r.write(0);
                r.write(signature, 0, 20);
            } else {
                r.write(signature, 0, 20);
            }

            asn.writeData(r.toByteArray());
            asn.writeByte(0x02);

            if (((signature[20] & 0x80) == 0x80) && (signature[20] != 0x00)) {
                s.write(0);
                s.write(signature, 20, 20);
            } else {
                s.write(signature, 20, 20);
            }

            asn.writeData(s.toByteArray());

            SimpleASNWriter asnEncoded = new SimpleASNWriter();
            asnEncoded.writeByte(0x30);
            asnEncoded.writeData(asn.toByteArray());

            byte[] encoded = asnEncoded.toByteArray();

            if (log.isDebugEnabled()) {
                log.debug("Verifying host key signature");
                log.debug("Signature length is " +
                    String.valueOf(signature.length));
View Full Code Here

TOP

Related Classes of com.adito.security.pki.SimpleASNWriter

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.