Package sun.misc

Examples of sun.misc.BASE64Decoder


    }

    public String getAuthHeader (String token) throws IOException {
        byte[] input = null;
        if (token != null)
            input = (new BASE64Decoder()).decodeBuffer(token);
        byte[] b = getNextToken (crdHandle, input);
        if (b == null)
            throw new IOException ("Internal authentication error");
        return (new B64Encoder()).encode (b);
    }
View Full Code Here


        if (infos == null) {
            throw new SecurityException("cannot verify signature block file " +
                                        name);
        }

        BASE64Decoder decoder = new BASE64Decoder();

        CodeSigner[] newSigners = getSigners(infos, block);

        // make sure we have something to do all this work for...
        if (newSigners == null)
View Full Code Here

        is.skip(len);

        // Now, that data is supposed to be a single X.509 certificate or
        // X.509 CRL or PKCS#7 formatted data... Base64 encoded.
        // Decode into binary and return the result.
        BASE64Decoder decoder = new BASE64Decoder();
        return decoder.decodeBuffer(strBuf.toString());
    }
View Full Code Here

    public ManifestEntryVerifier(Manifest man)
    {
        createdDigests = new HashMap<String, MessageDigest>(11);
        digests = new ArrayList<MessageDigest>();
        manifestHashes = new ArrayList<byte[]>();
        decoder = new BASE64Decoder();
        this.man = man;
    }
View Full Code Here

        if ((attr = attrs.get(JAVA_ATTRIBUTES[REF_ADDR])) != null) {

            String val, posnStr, type;
            char separator;
            int start, sep, posn;
            BASE64Decoder decoder = null;

            ClassLoader cl = helper.getURLClassLoader(codebases);

            /*
             * Temporary Vector for decoded RefAddr addresses - used to ensure
             * unordered addresses are correctly re-ordered.
             */
            Vector refAddrList = new Vector();
            refAddrList.setSize(attr.size());

            for (NamingEnumeration vals = attr.getAll(); vals.hasMore(); ) {

                val = (String)vals.next();

                if (val.length() == 0) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - "+
                        "empty attribute value");
                }
                // first character denotes encoding separator
                separator = val.charAt(0);
                start = 1// skip over separator

                // extract position within Reference
                if ((sep = val.indexOf(separator, start)) < 0) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - " +
                        "separator '" + separator + "'" + "not found");
                }
                if ((posnStr = val.substring(start, sep)) == null) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - " +
                        "empty RefAddr position");
                }
                try {
                    posn = Integer.parseInt(posnStr);
                } catch (NumberFormatException nfe) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - " +
                        "RefAddr position not an integer");
                }
                start = sep + 1; // skip over position and trailing separator

                // extract type
                if ((sep = val.indexOf(separator, start)) < 0) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - " +
                        "RefAddr type not found");
                }
                if ((type = val.substring(start, sep)) == null) {
                    throw new InvalidAttributeValueException(
                        "malformed " + JAVA_ATTRIBUTES[REF_ADDR] + " attribute - " +
                        "empty RefAddr type");
                }
                start = sep + 1; // skip over type and trailing separator

                // extract content
                if (start == val.length()) {
                    // Empty content
                    refAddrList.setElementAt(new StringRefAddr(type, null), posn);
                } else if (val.charAt(start) == separator) {
                    // Double separators indicate a non-StringRefAddr
                    // Content is a Base64-encoded serialized RefAddr

                    ++start;  // skip over consecutive separator
                    // %%% RL: exception if empty after double separator

                    if (decoder == null)
                        decoder = new BASE64Decoder();

                    RefAddr ra = (RefAddr)
                        deserializeObject(
                            decoder.decodeBuffer(val.substring(start)),
                            cl);

                    refAddrList.setElementAt(ra, posn);
                } else {
                    // Single separator indicates a StringRefAddr
View Full Code Here

        try {
            String response;
            byte[] incoming = null;
            String[] parts = raw.split("\\s+");
            if (parts.length > 1) {
                incoming = new BASE64Decoder().decodeBuffer(parts[1]);
            }
            response = scheme + " " + new B64Encoder().encode(
                        incoming==null?firstToken():nextToken(incoming));

            conn.setAuthenticationProperty(getHeaderName(), response);
View Full Code Here

            throw new IOException("Unable to read InputStream: " +
                                  ioe1.getMessage());
        }
        if (line.equals(X509Factory.BEGIN_CERT)) {
            /* stream appears to be hex-encoded bytes */
            BASE64Decoder         decoder   = new BASE64Decoder();
            ByteArrayOutputStream decstream = new ByteArrayOutputStream();
            try {
                while ((line = certBufferedReader.readLine()) != null) {
                    if (line.equals(X509Factory.END_CERT)) {
                        der = new DerValue(decstream.toByteArray());
                        break;
                    } else {
                        decstream.write(decoder.decodeBuffer(line));
                    }
                }
            } catch (IOException ioe2) {
                throw new IOException("Unable to read InputStream: "
                                      + ioe2.getMessage());
View Full Code Here

        return new HexBinary(s);
    }

    public static byte[] convertTobase64Binary(String s) throws Exception{
        //using the Sun's base64 decoder that should come with the JRE
        return new BASE64Decoder().decodeBuffer(s);
    }
View Full Code Here

    return DiscoInputReplicaProtocol.raw + DiscoInputReplicaProtocol.URL_SCHEME
            + removeNewlines((new BASE64Encoder()).encode(str.getBytes()));
  }

  public static String decodeRaw(final String str) throws IOException {
    return new String(new BASE64Decoder().decodeBuffer(str));
  }
View Full Code Here

  public static String decodeRaw(final String str) throws IOException {
    return new String(new BASE64Decoder().decodeBuffer(str));
  }

  public static String decodeRaw(final ReadableByteChannel channel) throws IOException {
    return new String(new BASE64Decoder().decodeBuffer(Channels.newInputStream(channel)));
  }
View Full Code Here

TOP

Related Classes of sun.misc.BASE64Decoder

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.