IRISLIB database
EncryptedData Class Reference
Inheritance diagram for EncryptedData:
Collaboration diagram for EncryptedData:

Public Member Functions

_.Library.Status EncryptStream (_.Library.BinaryStream messageStream, _.Library.ListOfObjects encryptedKeys)
 EncryptStream encrypts messageStream and stores the encrypted content of. More...
 
 Reset ()
 Reset the element.
 
- Public Member Functions inherited from EncryptedType
 SetEncryptionMethod (_.Library.String algorithm)
 Set the key transport algorithm to be used to encrypt the symmetric key. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 
- Public Member Functions inherited from Adaptor
_.Library.Status XMLExport (_.Library.String top, _.Library.String format, _.XML.Namespaces namespaces, attrs, _.Library.String createId, _.Library.String typeAttr, oreflist, idlist, _.Library.String initialIndent, _.Library.Boolean local, _.Net.MIMEPart mimeAttachments)
 Serialize an XML enabled class as an XML document and write. More...
 
_.Library.Status XMLExportToStream (_.Stream.Object export, _.Library.String top, _.Library.String format, _.XML.Namespaces namespaces, attrs, _.Library.String createId, _.Library.String typeAttr, oreflist, idlist, _.Library.String initialIndent)
 Serialize an XML enabled class as an XML document and appends it to a stream. More...
 
_.Library.Status XMLExportToString (_.Library.String export, _.Library.String top, _.Library.String format, _.XML.Namespaces namespaces, attrs, _.Library.String createId, _.Library.String typeAttr, oreflist, idlist, _.Library.String initialIndent)
 Serialize an XML enabled class as an XML document and write it to a string. More...
 

Static Public Member Functions

_.XML.Security.EncryptedData Create (_.XML.Security.EncryptedKey keyElement, _.SOAP.Security.Element elementToEncrypt, _.Library.Integer referenceOption)
 Create a EncryptedData element that is to be referenced from a ReferenceList Security element and. More...
 
_.Library.Boolean ValidateDocument (_.XML.Document document, _.Library.ListOfObjects encryptedKeys)
 Validate a XML.Document containing a parsed XML document which contains an EncryptedData. More...
 
- Static Public Member Functions inherited from Adaptor
_.Library.Status XMLDTD (_.Library.String top, _.Library.String format, _.Library.Boolean input, dtdlist)
 Write the DTD to the current device for this XML enabled class serialized as. More...
 
_.Library.RegisteredObject XMLNew (_.XML.Document document, _.Library.Integer node, _.Library.RegisteredObject containerOref)
 Get an instance of an XML enabled class. More...
 
_.Library.Status XMLSchema (_.Library.String top, _.Library.String format, _.Library.String namespacePrefix, _.Library.Boolean input, _.Library.Boolean refOnly, schema)
 Write an XML Schema fragment to the current device which describes an XML enabled class and dependent classes. More...
 
_.Library.String XMLSchemaNamespace ()
 Get the namespace to which this class belongs for use in schema generation. More...
 
_.Library.Status XMLSchemaType (_.XML.Schema schemaInstance, _.XML.Node node, _.Library.String top, _.Library.Boolean encoded, _.Library.Boolean summary, _.Library.Boolean input, _.Library.Boolean refOnly)
 Add a complexType to the schema that is respresented by an <class>XML.Schema</class> instance. More...
 

Public Attributes

 CipherData
 Override of XML.Security.EncryptedType property to allow > 32k of data. More...
 
 EncryptionProperties
 Unchanged override of XML.Security.EncryptedType property to maintain element position. More...
 
- Public Attributes inherited from EncryptedType
 Algorithm
 Encryption algorithm to use. More...
 
 Encoding
   More...
 
 EncryptionMethod
   More...
 
 Id
   More...
 
 KeyInfo
   More...
 
 KeySize
 Size of key. More...
 
 MimeType
   More...
 
 RequireBestEntropy
 RequireBestEntropy - Require best entropy source for initialization. More...
 
 Type
   More...
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 
- Static Public Attributes inherited from Adaptor
 ATTRIBUTEQUALIFIED = None
 ATTRIBUTEQUALIFIED controls the format of exported XML by controlling whether attributes. More...
 
 ELEMENTQUALIFIED = None
 ELEMENTQUALIFIED controls the format of exported XML. More...
 
 NAMESPACE = None
 NAMESPACE specifies the XML namespace to be used when projecting the. More...
 
 SUPPRESSTYPEPREFIX = None
 SUPPRESSTYPEPREFIX allows the type name that refers to this class. More...
 
 XMLDEFAULTREFERENCE = None
 XMLDEFAULTREFERENCE specifies the default value of the XMLREFERENCE property parameter. More...
 
 XMLENABLED = None
 If this parameter is true then XML-enabling methods. More...
 
 XMLFORMAT = None
 The XMLFORMAT parameter controls the generation of the XMLExport and XMLImport. More...
 
 XMLIGNOREINVALIDATTRIBUTE = None
 The XMLIGNOREINVALIDATTRIBUTE parameter allows the programmer to control handling of unexpected. More...
 
 XMLIGNOREINVALIDTAG = None
 The XMLIGNOREINVALIDTAG parameter allows the programmer to control handling of unexpected. More...
 
 XMLIGNORENULL = None
 XMLIGNORENULL allows the programmer to override the default XML handling. More...
 
 XMLINCLUDEINGROUP = None
 XMLINCLUDEINGROUP allows the programmer to control whether a class is included. More...
 
 XMLINHERITANCE = None
 If the XMLINHERITANCE parameter is set to "LEFT", then in the case of multiple. More...
 
 XMLNAME = None
 This parameter provides the default XMLNAME for the class. More...
 
 XMLNIL = None
 The XMLNIL class parameter controls the use of xsi:nil by XMLExport. More...
 
 XMLNILNOOBJECT = None
 The XMLNILNOOBJECT parameter allows creation of an object to be skipped for elements. More...
 
 XMLPREFIX = None
 The XMLPREFIX parameter controls the prefix to be used for the XML namespace that. More...
 
 XMLSEQUENCE = None
 If the XMLSEQUENCE = 1, then the order of the XML elements must match the. More...
 
 XMLSUMMARY = None
 The summary fields to be used when an object is referenced are specified. More...
 
 XMLTYPE = None
 This parameter provides the default XMLTYPE for the class. More...
 
 XMLUNSWIZZLE = None
 If the XMLUNSWIZZLE parameter is set to 1, then single object. More...
 
 XMLUSEEMPTYELEMENT = None
 If the XMLUSEEMPTYELEMENT parameter is set to 1, then the empty element shorthand (<tag>) More...
 

Detailed Description

For details on using this class, see Encrypting XML Documents. and Encrypting SOAP Security Headers.

XML Encryption element.

Member Function Documentation

◆ Create()

_.XML.Security.EncryptedData Create ( _.XML.Security.EncryptedKey  keyElement,
_.SOAP.Security.Element  elementToEncrypt,
_.Library.Integer  referenceOption 
)
static

Create a EncryptedData element that is to be referenced from a ReferenceList Security element and.

that is to carry content encrypted with a symmetric key specified by its KeyInfo element.

  • keyElement is the Security element which will supply the symmetric key.
    keyElement is meaningful only when referenceOption specified. See referenceOption for details.
  • The elementToEncrypt argument specifies the oref of the element to be encrypted. It is currently only valid to encrypt the body or a Security element. The default is "" which means to encrypt the body.
  • The referenceOption argument specifies the type of reference which will be in the KeyInfo. If referenceOption is "" or not specified, no KeyInfo is created. This is the default.
    • $$$SOAPWSReferenceEncryptedKey is reference to an EncryptedKey element in this message. The keyElement argument must be specified and is the EncryptedKey element.
    • $$$SOAPWSReferenceEncryptedKeySHA1 is reference by the SHA1 hash of the key contained in the EncryptedKey element specified as the first argument. If the keyElement is not specified, the key from the first EncryptedKey element in the received message is used.
    • $$$SOAPWSReferenceDerivedKey is reference to a DerivedKeyToken element in this message. The keyElement argument must be specified and is the DerivedKeyToken element. The key size to be used for this EncryptedData element must be specified by setting the Algorithm property or by setting the Length property of the DerivedKey.
    • $$$SOAPWSReferenceSCT is reference by wsu:Id to a SecurityContextToken element in this message. The keyElement argument must be specified and is the SecurityContextToken element.
    • $$$SOAPWSReferenceSCTIdentifier is reference by Identifier and Instance to a SecurityContextToken element not necessarily in this message. The keyElement argument must be specified and is the SecurityContextToken element.

◆ EncryptStream()

_.Library.Status EncryptStream ( _.Library.BinaryStream  messageStream,
_.Library.ListOfObjects  encryptedKeys 
)

EncryptStream encrypts messageStream and stores the encrypted content of.

messageStream as the CipherData. This completed EncryptedData instance may be exported using XML.Writer to create an EncyptedData element as required by the XML Encryption specification.

messageStream is the stream containing the data to be encrypted. messageStream must be positioned before calling EncryptStream – for example by calling Rewind first.

encryptedKeys is a ListOfObjects of instances of XML.Security.EncryptedKey. The EncyptedStream method will compute a common random, symmetric key for all the elements in encryptedKeys and store the encrypted symmetric key in the EncryptedKey instance. Encryption of the symmetric key is done using the public key from the X.509 credentials associated with the EncyptedKey instance. The result is that messageStream may be decrypted by any recipient that has the private key associated with the X.509 certificate in one of the EncryptedKey instances.

The default value of any property of EncryptedData, such as Algorithm, Type and RequireBestEntropy, may be overridden before calling EncryptStream.

The following example encrypts messageStream based on the certifcates in the credentials called cred1 and cred2.

set encryptedKeys=##class(ListOfObjects).New() set x5091 = ##class(SYS.X509Credentials).GetByAlias("cred1") do encryptedKeys.Insert(##class(#XML.Security.EncryptedKey).CreateX509( x5091,,$$$KeyInfoX509SKI)) set x5092 = ##class(SYS.X509Credentials).GetByAlias("cred2") do encryptedKeys.Insert(##class(#XML.Security.EncryptedKey).CreateX509( x5092,,$$$KeyInfoX509SKI)) set encryptedData=##class(#XML.Security.EncryptedData).New() set encryptedData.Algorithm=$$$SOAPWSaes256cbc ; default is $$$SOAPWSaes128cbc set encryptedData.Type=$$$SOAPWSEncryptElement ; default is $$$SOAPWSEncryptContent do messageStream.Rewind() set status=encryptedData.EncryptStream(messageStream, encryptedKeys) if $$$ISERR(status) .... handle error ....

◆ ValidateDocument()

_.Library.Boolean ValidateDocument ( _.XML.Document  document,
_.Library.ListOfObjects  encryptedKeys 
)
static

Validate a XML.Document containing a parsed XML document which contains an EncryptedData.

element and EncryptedKey elements.

document is the parsed document.

If decryption is valid, the document argument is updated with a new document which has the EncryptedData element replaced by the decypted text and true (1) is returned. If invalid return false (0).

encryptedKeys is a ListOfObjects of instances of XML.Security.EncryptedKey. The ValidateDocument method will decrypt the CipherData in the EncryptedData element found in the document based on one of the EncryptedKey elements in encryptedKeys. Any EncryptedKey elemetns which do not result in successful decryption are ignored. The result is that the EncryptedData in document may be decrypted by any recipient that has the private key associated with the X.509 certificate in one of the EncryptedKey instances.

The following example assumes a single argument web service method with the argument named arg. This will usually be the case with an entire message being the argument since Parameter ARGUMENTSTYLE = "message". The EncryptedData to validate and decrypt is the SOAP message whose XML.Document is contained in the ImportHandler property of the service.

// Keys element is property containing a list of EncryptedKey elements. // Keys is an arbitrary property name set document=..ImportHandler if ##class(XML.Security.EncryptedData).ValidateDocument(.document,arg.Keys) { set reader=##class(XML.Reader).New() set reader.Document=document ; updated document to a reader instance do reader.Correlate(.... ; Use reader to create classes ... Use Next loop to process payload ... } else { ... process error ... }

Member Data Documentation

◆ CipherData

Override of XML.Security.EncryptedType property to allow > 32k of data.

 

◆ EncryptionProperties

Unchanged override of XML.Security.EncryptedType property to maintain element position.