public static String decode(String encoded,AMEncryption encr){
  if (checkCaller()) {
    try {
      ISSecurityPermission isp=new ISSecurityPermission("access","adminpassword");
      if (securityManager != null) {
        securityManager.checkPermission(isp);
      }
    }
 catch (    SecurityException e) {
      Debug debug=Debug.getInstance("amSDK");
      debug.error("Security Alert: Unauthorized access to " + "Encoding/Decoding password utility: Returning NULL",e);
      return null;
    }
  }
  if (encoded == null || encoded.length() == 0) {
    return (null);
  }
  byte[] encData=null;
  encData=Base64.decode(encoded.trim());
  if (encData == null) {
    return null;
  }
  byte[] rawData=encr.decrypt(encData);
  if (rawData == null) {
    return (null);
  }
  String answer=null;
  try {
    answer=new String(rawData,"utf-8");
  }
 catch (  UnsupportedEncodingException uue) {
    Debug debug=Debug.getInstance("amSDK");
    debug.error("Crypt:: Unsupported encoding UTF-8",uue);
    answer=new String(rawData);
  }
  return (answer);
}

public static String decode ( String encoded , AMEncryption encr ) { if ( checkCaller ( ) ) { try { ISSecurityPermission isp = new ISSecurityPermission ( "access" , "adminpassword" ) ; if ( securityManager != null ) { securityManager . checkPermission ( isp ) ; } } catch ( SecurityException e ) { Debug debug = Debug . getInstance ( "amSDK" ) ; debug . error ( "Security Alert: Unauthorized access to " + "Encoding/Decoding password utility: Returning NULL" , e ) ; return null ; } } if ( encoded == null || encoded . length ( ) == 0 ) { return ( null ) ; } byte [ ] encData = null ; encData = Base64 . decode ( encoded . trim ( ) ) ; if ( encData == null ) { return null ; } byte [ ] rawData = encr . decrypt ( encData ) ; if ( rawData == null ) { return ( null ) ; } String answer = null ; try { answer = new String ( rawData , "utf-8" ) ; } catch ( UnsupportedEncodingException uue ) { Debug debug = Debug . getInstance ( "amSDK" ) ; debug . error ( "Crypt:: Unsupported encoding UTF-8" , uue ) ; answer = new String ( rawData ) ; } return ( answer ) ; }
decode an encoded string
