Package sun.misc

Examples of sun.misc.BASE64Decoder


      }
      else if(parName.equals("OLD_NOTES")){
       
        String oldNotest = (String)request.getAttribute("OLD_NOTES");
        try {
          oldNotes =new String(new BASE64Decoder().decodeBuffer(oldNotest));
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      else if(parName.equals("notes")){
        notes = (String)request.getAttribute("notes");
      }
        }
       
        if (objId != null && !objId.equals("")){
          if (userId != null && !userId.equals("")){
           
            boolean canSee = false;
           
            BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(new Integer(objId));
            try {
            canSee = ObjectsAccessVerifier.canSee(obj, profile2);
          } catch (EMFInternalError e1) {
            e1.printStackTrace();
          }
          if (!canSee) {
            logger.error("Object with label = '" + obj.getLabel()
                + "' cannot be executed by the user!!");
            Vector v = new Vector();
            v.add(obj.getLabel());
            throw new EMFUserError(EMFErrorSeverity.ERROR, "1075", v, null);
          }
          // get all correct execution roles
          List correctRoles = new ArrayList();
          try {
            correctRoles = DAOFactory.getBIObjectDAO().getCorrectRolesForExecution(new Integer(objId), profile2);
          } catch (NumberFormatException e2) {
            e2.printStackTrace();
          }
          if (correctRoles == null || correctRoles.size() == 0) {
            logger.warn("Object cannot be executed by no role of the user");
            throw new EMFUserError(EMFErrorSeverity.ERROR, 1006);
          }
           
            String tempOldNotest = getNotes(execIdentifier, objId );
            String tempOldNotes = "" ;
            try {
              tempOldNotes =new String(new BASE64Decoder().decodeBuffer(tempOldNotest));
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
           
View Full Code Here


      logger.debug("list of images sourcebean extracted from response" + images);
      SourceBean firstImageSB = (SourceBean) images.get(0);
      logger.debug("first images sourcebean recovered");
      String firstImgBase64 = firstImageSB.getCharacters();
      logger.debug("base 64 encoded image bytes retrived " + firstImgBase64);
      BASE64Decoder decoder = new BASE64Decoder();
      byte[] firstImg = decoder.decodeBuffer(firstImgBase64);
      logger.debug("image bytes decoded " + firstImg);
      // store image into cms
      IDossierPartsTempDAO dptDAO = DAOFactory.getDossierPartsTempDAO();
      dptDAO.setUserProfile(profile);
      dptDAO.storeImage(dossier.getId(), firstImg, confDoc.getLogicalName(), numPage, workflowProcessId);
View Full Code Here

    public String readText() {



        final sun.misc.BASE64Decoder base64decoder = new BASE64Decoder();
        // DECODE encryptedPwd String
        //what about encoding of scanner (utf8?) - maybe we should just open a file stream and read bytes, sounds safer
        final Scanner s;
        try {
            mkFile();
            s = new Scanner(f, "UTF8");
            final StringBuffer t = new StringBuffer();

            while (s.hasNext()) {
                t.append(s.next());
            }

            s.close();

            System.out.println("readText(), t is: " + t.toString());

            final byte[] encrypedPwdBytes = base64decoder.decodeBuffer(t.toString());

            return new String(encrypedPwdBytes);

        } catch (Exception ex) {
            Logger.getLogger(EncDecHelper.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

    public String readText() {

      

        final sun.misc.BASE64Decoder base64decoder = new BASE64Decoder();
        // DECODE encryptedPwd String
        //what about encoding of scanner (utf8?) - maybe we should just open a file stream and read bytes, sounds safer
        final Scanner s;
        try {
             mkFile();
            s = new Scanner(f, "UTF-8");
            final StringBuffer t = new StringBuffer();

            while (s.hasNext()) {
                t.append(s.next());
            }

            final byte[] encrypedPwdBytes = base64decoder.decodeBuffer(t.toString());

            cipher.init(Cipher.DECRYPT_MODE, key);

            byte[] plainTextPwdBytes = (cipher.doFinal(encrypedPwdBytes));
View Full Code Here

    try{
      fos = new FileOutputStream(path,append);
       
      if(isBase64)
      {
        new BASE64Decoder().decodeBuffer(is, fos);
      }else{
        byte[] b = new byte[BUFFER_SIZE];
        int len = -1;
        while( (len = is.read(b) ) > 0)
        {
View Full Code Here

     <p>Decode a base64 formatted string</p>
     @param u a base64 formatted string
     @return data, in bytes
  */
  public static final byte[] getDecoded(final String u) {
    BASE64Decoder decoder = new BASE64Decoder();

    try {
      return decoder.decodeBuffer(u);
    }
    catch (IOException e) {
      byte[] temp = {(byte) 0};
      return temp;
    }
View Full Code Here

  public static String decrypt(String encryptKey) {
    // let's ignore the salt
    if (!StringUtil.isEmpty(encryptKey) &&
        encryptKey.length() > 12) {
      String cipher = encryptKey.substring(12);
      BASE64Decoder decoder = new BASE64Decoder();
      try {
        return new String(decoder.decodeBuffer(cipher));
      } catch (IOException e) {
        throw new InvalidImplementationException(
            "Failed to perform decryption for key ["+encryptKey+"]",e);
      }
    } else
View Full Code Here

    String[] encryptedCredentials = readFromStorage(person,bookmarkingSource);
    if(person != null && encryptedCredentials != null){
      String mbox_sha1sum = person.getMbox_sha1sum();
      PBEKeySpec keySpec = new PBEKeySpec(mbox_sha1sum.toCharArray());
      try {
        BASE64Decoder decoder = new BASE64Decoder();
       
        SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
        PBEParameterSpec paramSpec = new PBEParameterSpec(loginSalt, ITERATIONS);   
        cipher.init(Cipher.DECRYPT_MODE, secretKey,paramSpec);
        String secretLogin = URLDecoder.decode(encryptedCredentials[0],"UTF-8");
        byte[] loginBytes = cipher.doFinal(decoder.decodeBuffer(secretLogin));
        String login = new String(loginBytes);
       
       
        paramSpec = new PBEParameterSpec(passwordSalt,ITERATIONS);
        cipher.init(Cipher.DECRYPT_MODE,secretKey,paramSpec);
        String secretPassword = URLDecoder.decode(encryptedCredentials[1],"UTF-8");
        byte[] passwordBytes = cipher.doFinal(decoder.decodeBuffer(secretPassword));
        String password = new String(passwordBytes);
       
        credentials = new TaggingCredential(bookmarkingSource.getType(),login,password);
       
        addToMap(sscfPerson,credentials);
View Full Code Here

        return succes;
    }
   
    public static String encrypt(String cookieContent) {
        try {
            byte[] salt = new BASE64Decoder().decodeBuffer(loadProperty("salt"));
            SecretKeySpec key = new SecretKeySpec(salt, "AES");
           
            Cipher cipher = Cipher.getInstance("AES");
            cipher.init(Cipher.ENCRYPT_MODE, key);
           
View Full Code Here

        return null;
    }
   
    public static String decrypt(String shoppingcart) throws Exception {
        try {
            byte[] salt = new BASE64Decoder().decodeBuffer(loadProperty("salt"));
            SecretKeySpec key = new SecretKeySpec(salt, "AES");
           
            Cipher cipher = Cipher.getInstance("AES");
            cipher.init(Cipher.DECRYPT_MODE, key);
           
            byte[] plaintext = cipher.doFinal(new BASE64Decoder().decodeBuffer(shoppingcart));
            return new String(plaintext);
        } catch (Exception ex) {
            throw ex;
        }
    }
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.