Package sun.misc

Examples of sun.misc.BASE64Decoder


            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


        try {
            SecretKeySpec key = new SecretKeySpec(strkey.getBytes(), "Blowfish");
            Cipher cipher = Cipher.getInstance("Blowfish");
            cipher.init(Cipher.DECRYPT_MODE, key);

            BASE64Decoder dec = new BASE64Decoder();
            byte[] bytes = dec.decodeBuffer(to_decrypt);

            byte[] decrypted = cipher.doFinal(bytes);

            return new String(decrypted);
        } catch (Exception e) {
View Full Code Here

     * @param key
     * @return
     * @throws Exception
     */
    public static String decryptBASE64ToStr(String key) throws Exception {
        return new String((new BASE64Decoder()).decodeBuffer(key), "UTF-8");
    }
View Full Code Here

    public static String decryptBASE64ToStr(String key) throws Exception {
        return new String((new BASE64Decoder()).decodeBuffer(key), "UTF-8");
    }

    public static byte[] decryptBASE64(String key) throws Exception {
        return (new BASE64Decoder()).decodeBuffer(key);
    }
View Full Code Here

  /** Converts the string <code>pValue</code> into a
   * base64 encoded byte array.
   */
  public static byte[] decode(String pValue) throws IOException {
    return (new BASE64Decoder()).decodeBuffer(pValue);
  }
View Full Code Here

     * @param str
     * @return String
     * @throws IOException
     */
    public static String decodeString(String str) throws IOException {
        BASE64Decoder dec = new BASE64Decoder();
        String value = new String(dec.decodeBuffer(str));
       
        return (value);
    }
View Full Code Here

  private static String decPassword;

  public static final String decryptPassword(String encryptedPassword) {
    if (decPassword == null) {
      try {
        BASE64Decoder base64decoder = new BASE64Decoder();
        byte[] encrypedPwdBytes = base64decoder.decodeBuffer(encryptedPassword);

        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(Cipher.DECRYPT_MODE, getKey());
        byte[] plainTextPwdBytes = (cipher.doFinal(encrypedPwdBytes));
        decPassword = new String(plainTextPwdBytes);
View Full Code Here

     * @throws IOException If restoring failed.
     */
    @SuppressWarnings("unchecked")
    public int restoreFromMemento(String memento) throws IOException {
        final String dataString = memento.replaceAll("\\t", "\n");
        final byte[] dataBytes = new BASE64Decoder().decodeBuffer(dataString);
        final Object dataObject = new ClassedObjectTransmitter().turnClassedBytesToObject(dataBytes, null);
        if (dataObject instanceof Map) {
            this.treasureMap = (Map<String, TreasureHeap.Treasure>) dataObject;
            final int treasureCount = this.treasureMap.size();
            if (AgentopiaConstants.TREASURE_DEBUG) {
View Full Code Here

    /**
     * Returns the unencrypted contents of the supplied encrypted, base64 encoded string.
     */
    public String decrypt(String encryptedData) {
        try {
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] inputBytes = decoder.decodeBuffer(encryptedData);

            PBEKeySpec keySpec = new PBEKeySpec(key);
            SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
            SecretKey key = factory.generateSecret(keySpec);

View Full Code Here

            object = org.apache.commons.io.Charsets.UTF_16;
            FileUtils.readFileToByteArray((File) null);
            FileUtils.readLines((File) null);
            FileUtils.readLines((File) null, (Charset) null);
            FileUtils.readLines((File) null, "");
            new BASE64Decoder().decodeBuffer("");
            new BASE64Encoder().encode((byte[]) null);
        }
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.