gov.va.med.lom.javaBroker.util

Class PassphraseCrypto

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DES
      Encrypt algorithm
      static java.lang.String PBE_WITH_MD5_AND_DES
      The key format: password-based encrypt with MD5 and DES.
      static java.lang.String UTF8
      Encrytp encoding
    • Constructor Summary

      Constructors 
      Constructor and Description
      PassphraseCrypto() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static java.lang.String decrypt(java.lang.String encrypted, java.lang.String passPhrase)
      Create the key Decode base64 to get bytes of the secret word Prepare the parameter to the ciphers Decrypt Decode using utf-8
      static java.lang.String encrypt(java.lang.String plain, java.lang.String passPhrase)
      Create the key Prepare the parameter to the ciphers Create the ciphers Encode the string into bytes using utf-8 Encrypt Encode bytes to base64 to get a string
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PBE_WITH_MD5_AND_DES

        public static final java.lang.String PBE_WITH_MD5_AND_DES
        The key format: password-based encrypt with MD5 and DES.
        See Also:
        PBEKeySpec, Constant Field Values
    • Constructor Detail

      • PassphraseCrypto

        public PassphraseCrypto()
    • Method Detail

      • encrypt

        public static java.lang.String encrypt(java.lang.String plain,
                               java.lang.String passPhrase)
                                        throws java.lang.Exception
        • Create the key
        • Prepare the parameter to the ciphers
        • Create the ciphers
        • Encode the string into bytes using utf-8
        • Encrypt
        • Encode bytes to base64 to get a string
        Parameters:
        plain - The password to be decrypted.
        Returns:
        a base64 encoded encrypted password
        Throws:
        java.lang.Exception - a generic exception caused during the decrypt process.
      • decrypt

        public static java.lang.String decrypt(java.lang.String encrypted,
                               java.lang.String passPhrase)
                                        throws java.lang.Exception
        • Create the key
        • Decode base64 to get bytes of the secret word
        • Prepare the parameter to the ciphers
        • Decrypt
        • Decode using utf-8
        Parameters:
        encrypted - The password to be decrypted.
        Returns:
        a plain password.
        Throws:
        java.lang.Exception - a generic exception caused during the decrypt process.