Package org.openqreg.exception

Examples of org.openqreg.exception.PasswordException


      FileOutputStream fos = new FileOutputStream(keyPath);
      ks.store(fos, keyStorePassword.toCharArray());

      fos.close();
    } catch (Exception e) {
      throw new PasswordException("Can't store key because of:\n"
          + e.toString());
    }

  }
View Full Code Here


      FileInputStream fis = new FileInputStream(keyPath);
      ks.load(fis, keyStorePassword.toCharArray());
      key = ks.getKey(KeyAlias, keyPassword.toCharArray());
      fis.close();
    } catch (Exception e) {
      throw new PasswordException("Can't load key because of:\n" + e.toString());
    }
  }
View Full Code Here

   */
  public void generateKey() throws PasswordException {
    try {
      storedKey = kg.generateKey();
    } catch (Exception e) {
      throw new PasswordException("Can't generate key because of:\n"
          + e.toString());
    }
  }
View Full Code Here

      kg = KeyGenerator.getInstance("DES", "SunJCE");
      kg.init(keyLength);
      cipher = Cipher.getInstance(encryption);
      initiated = true;
    } catch (Exception e) {
      throw new PasswordException(
          "Can't initiate PasswordHandler because of:\n" + e.toString());
    }
  }
View Full Code Here

    String result = null;
    try {
      cipher.init(Cipher.ENCRYPT_MODE, key);
      result = new String(Base64.encodeBase64(cipher.doFinal(data)));
    } catch (Exception e) {
      throw new PasswordException("Can't encrypt message because of:\n"
          + e.toString());
    }
    return result;

  }
View Full Code Here

    try {
      if (encrypt(plaintext).equals(encryptedtext)) {
        return true;
      }
    } catch (PasswordException pe) {
      throw new PasswordException(pe.toString());
    }
    return false;
  }
View Full Code Here

      MessageDigest md5 = MessageDigest.getInstance("SHA");
      md5.update(text.getBytes("UTF-8"));
      byte[] doHash = md5.digest();
      result = new String(new Base64().encode(doHash));
    } catch (Exception e) {
      throw new PasswordException("couldn't make digest because of:\n" + e);
    }
    return result;

  }
View Full Code Here

    try {
      if ((generateHash(plainText)).equals(hashCode)) {
        return true;
      }
    } catch (Exception e) {
      throw new PasswordException("Can't compare passwords because of: \n"
          + e.toString());
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.openqreg.exception.PasswordException

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.