|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.MQe | +--com.ibm.mqe.attributes.MQeLocalSecure
This class is used to create a LocalSecure object that provides a simple local security service enabling a using application to apply a given attribute’s ( cryptor and compressor) components to protect local data.
This class is a descendant of MQe
.
Field Summary |
Constructor Summary | |
MQeLocalSecure()
Constructs an MQeLocalSecure object. |
Method Summary | |
void |
open(java.lang.String fileDesc,
java.lang.Object fileName)
Enables the using application to identify the target File. |
byte[] |
read(MQeAttribute attr,
java.lang.String localCipherKey)
Reads, unprotects and returns data from the target file. |
static void |
setStorageAdapter(java.lang.String adapterName)
Sets the storage adapter to be used by the Object |
void |
write(byte[] data,
MQeAttribute attr,
java.lang.String localCipherKey)
Protects and writes the given data to the target file. |
Methods inherited from class com.ibm.mqe.MQe |
abbreviate, alias, asciiToByte, byteToAscii, byteToHex, byteToHex, byteToInt, byteToLong, byteToShort, byteToUnicode, fileSeparator, getEventLogHandler, hexToAscii, hexToByte, intToByte, isCLDC, loadClass, loadObject, log, setEventLogHandler, setLoader, sliceByteArray, type, unicodeToByte, uniqueValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MQeLocalSecure()
Constructs an MQeLocalSecure object.
MQeAttribute
MQeLocalSecure ls = new MQeLocalSecure();
Method Detail |
public static void setStorageAdapter(java.lang.String adapterName)
Sets the storage adapter to be used by the Object
adapterName
- A string representing the adapter class or alias
public void open(java.lang.String fileDesc, java.lang.Object fileName)
Enables the using application to identify the target File.
Sets the target filename.
fileDesc
- A string identifying the target file directory.fileName
- A string identifying the target file name.
write(byte[], com.ibm.mqe.MQeAttribute, java.lang.String)
,
read(com.ibm.mqe.MQeAttribute, java.lang.String)
public void write(byte[] data, MQeAttribute attr, java.lang.String localCipherKey) throws java.lang.Exception
Protects and writes the given data to the target file.
data
- Data to protectattr
- MQeAttribute to be applied to protect datalocalCipherKey
- Password or passphrase String to be used to protect data
MQeException
- java.lang.Exception
- java.iotry { MQeDESCryptor des = new MQeDESCryptor(); MQeAttribute desA = new MQeAttribute(null, des, null); MQeLocalSecure ls = new MQeLocalSecure(); ls.open(".\\", "TestSecureData.txt"); ls.write(MQe.asciiToByte("0123456789abcdef..."), desA, "It_is_a_secret"); } catch (Exception e) {// Handle the Exception here. }
public byte[] read(MQeAttribute attr, java.lang.String localCipherKey) throws java.lang.Exception
Reads, unprotects and returns data from the target file.
attr
- MQeAttribute to be applied to unprotect datalocalCipherKey
- Password or passphrase String to be used to unprotect data
MQeException
- java.lang.Exception
- java.iopublic byte[] UseRead(MQeAttribute attr, String localCipherKey) throws Exception { byte[] data = null; try { MQeDESCryptor des = new MQeDESCryptor(); MQeAttribute desA = new MQeAttribute(null, des, null); MQeLocalSecure ls = new MQeLocalSecure(); ls.open(".\\", "TestSecureData.txt"); data = ls.read(desA, "It_is_a_secret"); String outData = MQe.byteToAscii(data); System.out.println("unprotected data =" + outData); } catch (Exception e) {// Handle the Exception here. } return data; }
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |