|
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.MQeAttribute | +--com.ibm.mqe.attributes.MQeMTrustAttribute
This class is used to create an attribute object enabling message-level protection of message objects in such a way that :
This class is a descendant of MQeAttribute
.
Field Summary |
Constructor Summary | |
MQeMTrustAttribute(MQeAuthenticator auth,
MQeCryptor crypt,
MQeCompressor compr)
Constructs an MQeMTrustAttribute object. |
Method Summary | |
void |
setHomeServer(java.lang.String addrPort,
java.lang.String adapter)
Sets address of home-server/alternative WebSphere MQ Everyplace node. |
void |
setPrivateRegistry(MQePrivateRegistry thisRegistry)
Sets active private registry. |
void |
setPublicRegistry(MQePublicRegistry thisRegistry)
Sets active public registry. |
void |
setTarget(java.lang.String target)
Set attribute target entity. |
Methods inherited from class com.ibm.mqe.MQeAttribute |
activate, authenticatedID, close, getAuthenticator, getCompressor, getCryptor, getRule, isAcceptable, setAuthenticator, setCompressor, setCryptor, setKey |
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 MQeMTrustAttribute(MQeAuthenticator auth, MQeCryptor crypt, MQeCompressor compr) throws MQeException
Constructs an MQeMTrustAttribute object.
auth
- null , not used.crypt
- An object reference to a symmetric MQeCryptor object
(MQeDESCryptor, MQe3DESCryptor, MQeRC4Cryptor, MQeRC6Cryptor or MQeMARSCryptor)compr
- null , not used.
MQeException
- Except_Not Supported : "invalid cryptor"MQePrivateRegistry
,
MQePublicRegistry
public void ConstructorExample() throws Exception { { // application on initiating QueueManager: // use MQeMTrustAttribute to protect a message between // pre-reg'd initiator 'Bruce1'and recipient 'Bruce8' // assume initiator's QueueManager initQM started // setup MTrustAttribute MQeMARSCryptor mars = new MQeMARSCryptor(); MQeMTrustAttribute msgA = new MQeMTrustAttribute(null, mars, null); // setup instantiate &activate sender (Bruce1)PrivReg String EntityName = "Bruce1"; String EntityPIN = "12345678"; Object KeyRingPassword = "It_is_a_secret"; MQePrivateRegistry sendreg = new MQePrivateRegistry(); sendreg.activate(EntityName, ".//MQeNode_PrivateRegistry", EntityPIN, KeyRingPassword, null, null); // set target entity's registry name into attribute msgA.setTarget("Bruce8"); // set MTrustAttribute s PrivateRegistry =sendreg msgA.setPrivateRegistry(sendreg); // instantiate and activate Public Registry which has // (or gets)MiniCert of intended recipient (Bruce8) MQePublicRegistry pr = new MQePublicRegistry(); pr.activate("MQeNode_PublicRegistry", ".//"); // set MTrustAttribute's PublicRegistry &HomeServer msgA.setPublicRegistry(pr); msgA.setHomeServer(MyHomeServerName + ":8082", "Network"); // create message object and add some test data MQeMsgObject msgObj = new MQeMsgObject(); msgObj.putArrayOfByte("TestData", MQe.asciiToByte("0123456789abcdef....")); // protect with MQeMTrustAttribute and PutMessage msgObj.setAttribute(msgA); initQM.putMessage(targetQMgrName, targetQName, msgObj, null, 0); } { // application on recipient QueueManager: // use MQeMTrustAttribute to recover the message from // pre-registered initiator 'Bruce1'and recipient 'Bruce8' // assume recipient's QueueManager recipQM started // setup MQeMTrustAttribute MQeMARSCryptor marsCryp = new MQeMARSCryptor(); MQeMTrustAttribute msgA = new MQeMTrustAttribute(null, marsCryp, null); // setup recipient's Private Registry String EntityName = "Bruce8"; String EntityPIN = "12345678"; Object KeyRingPassword = "It_is_a_secret"; // instantiate and activate recipient's Private Registry MQePrivateRegistry recipreg = new MQePrivateRegistry(); recipreg.activate(EntityName, ".//MQeNode_PrivateRegistry", EntityPIN, KeyRingPassword, null, null); // set MTrustAttribute PrivateRegistry =recipreg msgA.setPrivateRegistry(recipreg); // instantiate and activate Public Registry which has // (or gets)MiniCert of originator (Bruce1) MQePublicRegistry pr = new MQePublicRegistry(); pr.activate("MQeNode_PublicRegistry", ".//"); // set MTrustAttribute's PublicRegistry &HomeServer msgA.setPublicRegistry(pr); msgA.setHomeServer(MyHomeServerName + ":8082", "Network"); // use MQeMTrustAttribute with GetMessage to recover msg MQeMsgObject MsgObj = initQM.getMessage(targetQMgrName, targetQName, null, msgA, 0); System.out.println("Data restored from MTrustAttr protected Msg =" + MQe.byteToAscii(MsgObj.getArrayOfByte("TestData"))); } }
Method Detail |
public void setPublicRegistry(MQePublicRegistry thisRegistry) throws MQeException
Sets active public registry.
Called to set an MQeMTrustAttribute’s active public registry. When used to protect a message this is a public registry that has (or gets) the mini-certificate of the intended recipient, and when recovering a message this is a public registry that has (or gets) the mini-certificate of the sender.
MQeException
- Except_NotAllowed : "illegal SetPublicRegistry"public void setPrivateRegistry(MQePrivateRegistry thisRegistry) throws MQeException
Sets active private registry.
Called to set an MQeMTrustAttribute’s active private registry. When used to protect a message this is the private registry of the sender and when recovering a message this is the private registry of the recipient.
MQeException
- Except_NotAllowed : "illegal SetPrivateRegistry"public void setHomeServer(java.lang.String addrPort, java.lang.String adapter)
Sets address of home-server/alternative WebSphere MQ Everyplace node.
Called to set an MQeMTrustAttributes home-server address. When used to protect a message, encodeData() attempts to get the intended recipient’s mini-certificate from its active public registry. If not found but the home-server address is set, it requests the mini-certificate from the home-server, and saves it for subsequent use in the active public registry. When used to recover a message, decodeData() attempts to gets the initiator’s mini-certificate from its active public registry. If not found but the home-server address is set, it requests the mini-certificate from the home-server and saves it for subsequent use in its active public registry.
adapter
- The adapter class name or alias of the target queue manager.
public void setTarget(java.lang.String target) throws MQeException
Set attribute target entity.
Once it has been set, it cannot be re-set.
target
- The target name.
MQeException
- Except_NotAllowed : "illegal SetTarget"
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |