uk.org.ogsadai.common.rolemap
Class DecryptRoleMapperFile

java.lang.Object
  |
  +--uk.org.ogsadai.common.rolemap.DecryptRoleMapperFile

public class DecryptRoleMapperFile
extends java.lang.Object

Stand-alone utility for converting a rolemapper file compatible with the SimpleFileWithEncryptedPasswordsRoleMapper rolemapping implementation into one compatible with the SimpleFileRoleMapper rolemapping implementation.

Author:
The OGSA-DAI Project Team

Constructor Summary
DecryptRoleMapperFile(java.lang.String password, java.lang.String filename)
          Initialisation.
 
Method Summary
 java.lang.String decrypt()
          Change all instances of an encryptedPassword field in the file's contents into a password field, containing the decrypted version of the original value, and return a string with all the changes in place.
static void main(java.lang.String[] args)
          Perform the decryption of the passwords in the file.
 void writeToFile(java.lang.String contents)
          Delete the file pointed to by mFilename and replace it with a fresh file containing the value of contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecryptRoleMapperFile

public DecryptRoleMapperFile(java.lang.String password,
                             java.lang.String filename)
Initialisation.

Parameters:
password - the password to use as the decryption key
filename - the path to the rolemapper file
Method Detail

main

public static void main(java.lang.String[] args)
                 throws CommonException
Perform the decryption of the passwords in the file. Command line arguments: args[0] the password to use as the decryption key args[1] the path to the rolemapper file

Throws:
CommonException - if there's a problem decrypting the file

writeToFile

public void writeToFile(java.lang.String contents)
                 throws CommonException
Delete the file pointed to by mFilename and replace it with a fresh file containing the value of contents.

Parameters:
contents - the string to overwrite the file with
Throws:
CommonException - if there's a problem overwriting the file

decrypt

public java.lang.String decrypt()
                         throws CommonException
Change all instances of an encryptedPassword field in the file's contents into a password field, containing the decrypted version of the original value, and return a string with all the changes in place.

Returns:
the file's contents with the changes made
Throws:
CommonException - if there's a problem