Repository navigation
API XMLSec Core XMLEnc
API Group: xmlsec_core_xmlenc
XML Encryption (XMLEnc) implementation.
XML Encryption support. XML Encryption implementation.
Defined as: xmlSecEncCtxModeEncryptedData
Source: include/xmlsec/xmlenc.h
Deprecated. Use xmlSecEncCtxModeEncryptedData instead.
Defined as: xmlSecEncCtxModeEncryptedKey
Source: include/xmlsec/xmlenc.h
Deprecated. Use xmlSecEncCtxModeEncryptedKey instead.
Defined as: xmlSecEncCtxMode
Source: include/xmlsec/xmlenc.h
Deprecated. Use xmlSecEncCtxMode instead.
Defined as: 0x00000001
Source: include/xmlsec/xmlenc.h
If set, the replaced node will be returned in replacedNodeList.
If this flag is set, then the replaced node will be returned in the replacedNodeList.
Defined as: XMLSEC_ENC_FLAGS_RETURN_REPLACED_NODE
Source: include/xmlsec/xmlenc.h
Deprecated. Use XMLSEC_ENC_FLAGS_RETURN_REPLACED_NODE instead.
Source: include/xmlsec/xmlenc.h
The xmlSecEncCtx mode.
| Value | Initializer | Description |
|---|---|---|
xmlSecEncCtxModeEncryptedData |
0 |
the enc:EncryptedData/ element processing. |
xmlSecEncCtxModeEncryptedKey |
`` | the enc:EncryptedKey/ element processing. |
Source: include/xmlsec/xmlenc.h
XML Encryption processing failure reason.
XML Encryption processing failure reason. The application should use the returned value from the encrypt/decrypt functions to find out whether the operation succeeded or failed first; on failure the specific reason is stored in the failureReason field of _xmlSecEncCtx.
| Value | Initializer | Description |
|---|---|---|
xmlSecEncFailureReasonUnknown |
0 |
the failure reason is unknown. |
xmlSecEncFailureReasonKeyNotFound |
`` | the key is not found. |
xmlSecEncCtxPtr xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr);Source: include/xmlsec/xmlenc.h
Creates an enc:EncryptedData processing context.
Creates enc:EncryptedData/ element processing context. The caller is responsible for destroying returned object by calling xmlSecEncCtxDestroy function.
Parameters:
-
keysMngr— the pointer to keys manager.
Returns: pointer to newly allocated context object or NULL if an error occurs.
void xmlSecEncCtxDestroy(xmlSecEncCtxPtr encCtx);Source: include/xmlsec/xmlenc.h
Destroys an enc:EncryptedData processing context.
Destroy context object created with xmlSecEncCtxCreate function.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context.
int xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr);Source: include/xmlsec/xmlenc.h
Initializes an enc:EncryptedData processing context.
Initializes enc:EncryptedData/ element processing context. The caller is responsible for cleaning it up by calling xmlSecEncCtxFinalize function.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
keysMngr— the pointer to keys manager.
Returns: 0 on success or a negative value if an error occurs.
void xmlSecEncCtxFinalize(xmlSecEncCtxPtr encCtx);Source: include/xmlsec/xmlenc.h
Cleans up encCtx object.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context.
int xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src);Source: include/xmlsec/xmlenc.h
Copies user preferences from src to dst context.
Copies user preferences from src context to dst context.
Parameters:
-
dst— the pointer to destination context. -
src— the pointer to source context.
Returns: 0 on success or a negative value if an error occurs.
void xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx);Source: include/xmlsec/xmlenc.h
Resets the context, keeping user settings.
Resets encCtx object, user settings are not touched.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context.
int xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlSecByte *data, xmlSecSize dataSize);Source: include/xmlsec/xmlenc.h
Encrypts data according to template tmpl.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
tmpl— the pointer to enc:EncryptedData/ template node. -
data— the pointer for binary buffer. -
dataSize— thedatabuffer size.
Returns: 0 on success or a negative value if an error occurs.
int xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node);Source: include/xmlsec/xmlenc.h
Encrypts a node according to the template.
Encrypts node according to template tmpl. If requested, node is replaced with result enc:EncryptedData/ node.
Note: on error, the state of the tmpl is undefined and the caller should not make any assumptions about it. The recommended way is to release it with xmlUnlinkNode(tmpl); xmlFreeNode(tmpl); immediately.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
tmpl— the pointer to enc:EncryptedData/ template node. -
node— the pointer to node for encryption.
Returns: 0 on success or a negative value if an error occurs.
int xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *uri);Source: include/xmlsec/xmlenc.h
Encrypts data from a URI according to the template.
Encrypts data from uri according to template tmpl.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
tmpl— the pointer to enc:EncryptedData/ template node. -
uri— the URI.
Returns: 0 on success or a negative value if an error occurs.
int xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node);Source: include/xmlsec/xmlenc.h
Decrypts a node, replacing it if necessary.
Decrypts node and if necessary replaces node with decrypted data.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
node— the pointer to enc:EncryptedData/ node.
Returns: 0 on success or a negative value if an error occurs.
xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node);Source: include/xmlsec/xmlenc.h
Decrypts node data to the result.
Parameters:
-
encCtx— the pointer to encryption processing context. -
node— the pointer to enc:EncryptedData/ node.
Returns: a buffer with the decrypted data on success or NULL if an error occurs.
void xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE *output);Source: include/xmlsec/xmlenc.h
Prints debug information about the context.
Prints the debug information about encCtx to output.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
output— the pointer to output FILE.
void xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE *output);Source: include/xmlsec/xmlenc.h
Prints debug information about the context in XML format.
Prints the debug information about encCtx to output in XML format.
Parameters:
-
encCtx— the pointer to enc:EncryptedData/ processing context. -
output— the pointer to output FILE.
xmlSecKeyPtr xmlSecEncCtxDerivedKeyGenerate(xmlSecEncCtxPtr encCtx, xmlSecKeyDataId keyId, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx);Source: include/xmlsec/xmlenc.h
Generates (derives) a key from the DerivedKey node.
Generates (derives) key from node (https://www.w3.org/TR/xmlenc-core1/#sec-DerivedKey):
<element name="DerivedKey" type="xenc11:DerivedKeyType"/>
<complexType name="DerivedKeyType">
<sequence>
<element ref="xenc11:KeyDerivationMethod" minOccurs="0"/>
<element ref="xenc:ReferenceList" minOccurs="0"/>
<element name="DerivedKeyName" type="string" minOccurs="0"/>
<element name="MasterKeyName" type="string" minOccurs="0"/>
</sequence>
<attribute name="Recipient" type="string" use="optional"/>
<attribute name="Id" type="ID" use="optional"/>
<attribute name="Type" type="anyURI" use="optional"/>
</complexType>
<element name="KeyDerivationMethod" type="xenc:KeyDerivationMethodType"/>
<complexType name="KeyDerivationMethodType">
<sequence>
<any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>Parameters:
-
encCtx— the pointer to encryption processing context. -
keyId— the expected key id, the actual derived key might have a different id. -
node— the pointer to enc11:DerivedKey/ node. -
keyInfoCtx— the pointer to the "parent" key info context.
Returns: the derived key on success or NULL if an error occurs.
xmlSecKeyPtr xmlSecEncCtxAgreementMethodGenerate(xmlSecEncCtxPtr encCtx, xmlSecKeyDataId keyId, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx);Source: include/xmlsec/xmlenc.h
Generates a key from the AgreementMethod node.
Generates (derives) key from node (https://www.w3.org/TR/xmlenc-core1/#sec-AgreementMethod):
Parameters:
-
encCtx— the pointer to encryption processing context. -
keyId— the expected key id, the actual derived key might have a different id. -
node— the pointer to enc:AgreementMethod/ node. -
keyInfoCtx— the pointer to the "parent" key info context.
Returns: the generated key on success or NULL if an error occurs.
int xmlSecEncCtxAgreementMethodXmlWrite(xmlSecEncCtxPtr encCtx, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx);Source: include/xmlsec/xmlenc.h
Writes the AgreementMethod XML content into the node.
Writes the AgreementMethod XML content for the given encCtx into node.
Parameters:
-
encCtx— the pointer to encryption context. -
node— the pointer to the AgreementMethod XML node. -
keyInfoCtx— the pointer to key info context.
Returns: 0 on success or a negative value if an error occurs.
xmlSecKeyPtr xmlSecEncCtxEncapsulationMechanismGenerate(xmlSecEncCtxPtr encCtx, xmlSecKeyDataId keyId, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx);Source: include/xmlsec/xmlenc.h
Generates a key from the EncapsulationMechanism node.
Generates (decapsulates) a key from node:
Parameters:
-
encCtx— the pointer to encryption processing context. -
keyId— the expected key id, the actual generated key might have a different id. -
node— the pointer to as:EncapsulationMechanism/ node. -
keyInfoCtx— the pointer to the "parent" key info context.
Returns: the generated key on success or NULL if an error occurs.
int xmlSecEncCtxEncapsulationMechanismXmlWrite(xmlSecEncCtxPtr encCtx, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx);Source: include/xmlsec/xmlenc.h
Writes the EncapsulationMechanism XML content into the node.
Writes the EncapsulationMechanism XML content for the given encCtx into node.
Parameters:
-
encCtx— the pointer to encryption context. -
node— the pointer to the EncapsulationMechanism XML node. -
keyInfoCtx— the pointer to key info context.
Returns: 0 on success or a negative value if an error occurs.
const char * xmlSecEncCtxGetFailureReasonString(xmlSecEncFailureReason failureReason);Source: include/xmlsec/xmlenc.h
Gets failure reason as a string.
Parameters:
-
failureReason— the failure reason.
Returns: failure reason as a string.