|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.common.rolemap.EncryptRoleMapperFile
Stand-alone utility for converting an XML file with attributes of form
password="SOME PASSWORD"
so that the values within the
quotes are encrypted using a user-supplied encryption password and
the password
attribute has been renamed to
encryptedPassword
.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
private java.lang.String |
mFilename
|
private java.lang.String |
mPassword
|
Constructor Summary | |
EncryptRoleMapperFile(java.lang.String password,
java.lang.String filename)
Initialise the class with the encryption key and file name. |
Method Summary | |
java.lang.String |
encrypt()
Change all instances of a password attribute in the
file's contents into an encryptedPassword attribute,
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 current file and replace it with a new one with the given contents. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private java.lang.String mFilename
private java.lang.String mPassword
Constructor Detail |
public EncryptRoleMapperFile(java.lang.String password, java.lang.String filename)
password
- The password to use as the encryption key.filename
- The path to the file.Method Detail |
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- An array containin the encryption key password and the path
to the file to encrypt.
java.lang.Exception
- if there's a problem encrypting the filepublic void writeToFile(java.lang.String contents) throws java.lang.Exception
contents
- The new file content.
java.lang.Exception
- if there's a problem overwriting the file.public java.lang.String encrypt() throws java.lang.Exception
password
attribute in the
file's contents into an encryptedPassword
attribute,
containing the encrypted version of the original value, and
return a string with all the changes in place.
java.lang.Exception
- if there's a problem.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |