Arc::XMLSecNode Class Reference

Extends XMLNode class to support XML security operation. More...

#include <XMLSecNode.h>

Inheritance diagram for Arc::XMLSecNode:
Arc::XMLNode

Public Member Functions

 XMLSecNode (XMLNode &node)
void AddSignatureTemplate (const std::string &id_name, const SignatureMethod sign_method, const std::string &incl_namespaces="")
bool SignNode (const std::string &privkey_file, const std::string &cert_file)
bool VerifyNode (const std::string &id_name, const std::string &ca_file, const std::string &ca_path, bool verify_trusted=true)
bool EncryptNode (const std::string &cert_file, const SymEncryptionType encrpt_type)
bool DecryptNode (const std::string &privkey_file, XMLNode &decrypted_node)

Detailed Description

Extends XMLNode class to support XML security operation.

All XMLNode methods are exposed by inheriting from XMLNode. XMLSecNode itself does not own node, instead it uses the node from the base class XMLNode.


Constructor & Destructor Documentation

Arc::XMLSecNode::XMLSecNode ( XMLNode node  ) 

Create a object based on an XMLNode instance.


Member Function Documentation

void Arc::XMLSecNode::AddSignatureTemplate ( const std::string &  id_name,
const SignatureMethod  sign_method,
const std::string &  incl_namespaces = "" 
)

Add the signature template for later signing.

Parameters:
id_name The identifier name under this node which will be used for the <Signature> to refer to.
sign_method The sign method for signing. Two options now, RSA_SHA1, DSA_SHA1
bool Arc::XMLSecNode::DecryptNode ( const std::string &  privkey_file,
XMLNode decrypted_node 
)

Decrypt the <xenc:EncryptedData/> under this node, the decrypted node will be output in the second argument of DecryptNode method. And the <xenc:EncryptedData/> under this node will be removed after decryption.

Parameters:
privkey_file The private key file, which is used for decrypting
decrypted_node Output the decrypted node
bool Arc::XMLSecNode::EncryptNode ( const std::string &  cert_file,
const SymEncryptionType  encrpt_type 
)

Encrypt this node, after encryption, this node will be replaced by the encrypted node

Parameters:
cert_file The certificate file, the public key parsed from this certificate is used to encrypted the symmetric key, and then the symmetric key is used to encrypted the node
encrpt_type The encryption type when encrypting the node, four option in SymEncryptionType
verify_trusted Verify trusted certificates or not. If set to false, then only the signature will be checked (by using the public key from KeyInfo).
bool Arc::XMLSecNode::SignNode ( const std::string &  privkey_file,
const std::string &  cert_file 
)

Sign this node (identified by id_name).

Parameters:
privkey_file The private key file. The private key is used for signing
cert_file The certificate file. The certificate is used as the <KeyInfo> part of the <Signature>; <KeyInfo> will be used for the other end to verify this <Signature>
incl_namespaces InclusiveNamespaces for Tranform in Signature
bool Arc::XMLSecNode::VerifyNode ( const std::string &  id_name,
const std::string &  ca_file,
const std::string &  ca_path,
bool  verify_trusted = true 
)

Verify the signature under this node

Parameters:
id_name The id of this node, which is used for identifying the node
ca_file The CA file which used as trused certificate when verify the certificate in the <KeyInfo> part of <Signature>
ca_path The CA directory; either ca_file or ca_path should be set.

The documentation for this class was generated from the following file:
Generated on Wed Jun 27 11:54:31 2012 for Hosting Environment (Daemon) by  doxygen 1.6.3