Enigma (sorry about the trite name) is an api, based on OpenPGP, XML Encryption and XML Digital Signatures, to provide XML in-document crypto and digital signatures with element-level granularity.