uk.org.ogsadai.common.rolemap
Class EncryptRoleMapperFile

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

public class EncryptRoleMapperFile
extends java.lang.Object

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

Author:
The OGSA-DAI Project Team

Constructor Summary
EncryptRoleMapperFile(java.lang.String password, java.lang.String filename)
          Initialisation.
 
Method Summary
 java.lang.String encrypt()
          Change all instances of a password field in the file's contents into an encryptedPassword field, containing the encrypted version of the original value, and return a string with all the changes in place.
static void main(java.lang.String[] args)
          Perform the encryption 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

EncryptRoleMapperFile

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

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

main

public static void main(java.lang.String[] args)
                 throws CommonException
Perform the encryption of the passwords in the file.

Parameters:
args - An array of 2 String objects - args[0]: the password to use as the encryption key. args[1]: the path to the rolemapper file/
Throws:
CommonException - if there's a problem encrypting 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

encrypt

public java.lang.String encrypt()
                         throws CommonException
Change all instances of a password field in the file's contents into an encryptedPassword field, containing the encrypted 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