Last updated September 15, 2009 18:04, by ejoftheweb
Feedicon  

The leading players: Lock and Key

Lock

A Lock is an object which can be used either: to lock an object, so that only the lock owner can unlock it, or: to verify that the object has been signed by the owner of the lock,

Locking an Element

To lock a JDOM Element:

 lockedElement =  lock.lock(unLockedElement);

The locked Element replaces the unLocked element in the document tree. It will be an element in the XMLEncryption namespace.

Verifying a signature

To verify an XML signature, do this:

 lock.verify(signedElement);

(which returns true if the signature verifies correctly). Note that because Enigma is not yet a fully-compliant implementation of XML-DSIG, it won’t necessarily correctly verify an Element signed by another XML-DSIG application; however, a compliant XML-DSIG application should correctly verify a document signed by Enigma.

Concatenating Locks

Locks can be concatenated, so that a group of people can have a single Lock, which can be unlocked by any of its corresponding Keys. To concatenate a Lock, just call its addLock(Lock lock) method.

Key

Keys are used to unlock objects locked with a corresponding Lock. Keys are normally protected with a passphrase.

Unlocking an Element

To unlock an Element:

 unLockedElement=key.unlock(lockedElement,  passphrase);

Signing an Element

Keys can also be used to sign an element:

 signedElement=key.sign(unsighedElement, passphrase);

The resulting Element in the XML-DSIG namespace can be verified by any compliant XML-DSIG application.

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close