CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
signed_xml.h
1#pragma once
2
3#include <system/string.h>
4#include <system/shared_ptr.h>
5#include <system/object.h>
6#include <system/collections/object_model/collection.h>
7#include <security/cryptography/hash_algorithm.h>
8#include <cstdint>
9
10namespace System { namespace Xml { class XmlDocument; } }
11namespace System { namespace Xml { class XmlElement; } }
12namespace System { namespace Security { namespace Cryptography { class AsymmetricAlgorithm; } } }
13namespace System { namespace Security { namespace Cryptography { namespace Xml { class Transform; } } } }
14namespace System { namespace Security { namespace Cryptography { namespace Xml { class Reference; } } } }
15namespace System { namespace Security { namespace Cryptography { namespace Xml { class SignedInfo; } } } }
16namespace System { namespace Security { namespace Cryptography { namespace Xml { class KeyInfo; } } } }
17namespace System { namespace Security { namespace Cryptography { namespace Xml { class DataObject; } } } }
18namespace System { namespace Security { namespace Cryptography { namespace X509Certificates { class X509Certificate2; } } } }
19
20namespace System { namespace Security { namespace Cryptography { namespace Xml {
21
22namespace Details { struct ReferenceImpl; }
23namespace Details { struct SignedXmlImpl; }
24
29class ASPOSECPP_SHARED_CLASS SignedXml : public Object
30{
31 typedef SignedXml ThisType;
32 typedef Object BaseType;
33
34 typedef BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
35 ASPOSECPP_SHARED_RTTI_INFO_DECL();
36
37 friend class Reference;
38 friend class Transform;
39 friend struct Details::ReferenceImpl;
40 friend struct Details::SignedXmlImpl;
41
42public:
43 static const ASPOSECPP_SHARED_API String XmlDsigNamespaceUrl;
44 static const ASPOSECPP_SHARED_API String XmlDsigMinimalCanonicalizationUrl;
45 static const ASPOSECPP_SHARED_API String XmlDsigCanonicalizationUrl;
46 static const ASPOSECPP_SHARED_API String XmlDsigCanonicalizationWithCommentsUrl;
47 static const ASPOSECPP_SHARED_API String XmlDsigSHA1Url;
48 static const ASPOSECPP_SHARED_API String XmlDsigDSAUrl;
49 static const ASPOSECPP_SHARED_API String XmlDsigRSASHA1Url;
50 static const ASPOSECPP_SHARED_API String XmlDsigHMACSHA1Url;
51 static const ASPOSECPP_SHARED_API String XmlDsigSHA256Url;
52 static const ASPOSECPP_SHARED_API String XmlDsigRSASHA256Url;
53 static const ASPOSECPP_SHARED_API String XmlDsigSHA384Url;
54 static const ASPOSECPP_SHARED_API String XmlDsigRSASHA384Url;
55 static const ASPOSECPP_SHARED_API String XmlDsigSHA512Url;
56 static const ASPOSECPP_SHARED_API String XmlDsigRSASHA512Url;
57 static const ASPOSECPP_SHARED_API String XmlDsigC14NTransformUrl;
58 static const ASPOSECPP_SHARED_API String XmlDsigC14NWithCommentsTransformUrl;
59 static const ASPOSECPP_SHARED_API String XmlDsigExcC14NTransformUrl;
60 static const ASPOSECPP_SHARED_API String XmlDsigExcC14NWithCommentsTransformUrl;
61 static const ASPOSECPP_SHARED_API String XmlDsigBase64TransformUrl;
62 static const ASPOSECPP_SHARED_API String XmlDsigXPathTransformUrl;
63 static const ASPOSECPP_SHARED_API String XmlDsigXsltTransformUrl;
64 static const ASPOSECPP_SHARED_API String XmlDsigEnvelopedSignatureTransformUrl;
65 static const ASPOSECPP_SHARED_API String XmlDecryptionTransformUrl;
66 static const ASPOSECPP_SHARED_API String XmlLicenseTransformUrl;
67
68 ASPOSECPP_SHARED_API String get_SigningKeyName();
69 ASPOSECPP_SHARED_API void set_SigningKeyName(String value);
71 ASPOSECPP_SHARED_API void set_SigningKey(SharedPtr<AsymmetricAlgorithm> value);
72 ASPOSECPP_SHARED_API SharedPtr<SignedInfo> get_SignedInfo();
73 ASPOSECPP_SHARED_API String get_SignatureMethod();
74 ASPOSECPP_SHARED_API String get_SignatureLength();
75 ASPOSECPP_SHARED_API ArrayPtr<uint8_t> get_SignatureValue();
76 ASPOSECPP_SHARED_API SharedPtr<KeyInfo> get_KeyInfo();
77 ASPOSECPP_SHARED_API void set_KeyInfo(SharedPtr<KeyInfo> value);
78
79 ASPOSECPP_SHARED_API SignedXml();
80 ASPOSECPP_SHARED_API SignedXml(SharedPtr<System::Xml::XmlDocument> document);
82
84 ASPOSECPP_SHARED_API void LoadXml(SharedPtr<System::Xml::XmlElement> value);
85 ASPOSECPP_SHARED_API void AddReference(SharedPtr<Reference> reference);
86 ASPOSECPP_SHARED_API void AddObject(SharedPtr<DataObject> dataObject);
87 ASPOSECPP_SHARED_API bool CheckSignature();
88 ASPOSECPP_SHARED_API bool CheckSignatureReturningKey(SharedPtr<AsymmetricAlgorithm>& signingKey);
89 ASPOSECPP_SHARED_API bool CheckSignature(SharedPtr<AsymmetricAlgorithm> key);
90 ASPOSECPP_SHARED_API bool CheckSignature(SharedPtr<X509Certificates::X509Certificate2> certificate, bool verifySignatureOnly);
91 ASPOSECPP_SHARED_API void ComputeSignature();
93
94protected:
96
97 virtual ASPOSECPP_SHARED_API SharedPtr<AsymmetricAlgorithm> GetPublicKey();
98
99 virtual ASPOSECPP_SHARED_API ~SignedXml();
100
101#ifdef ASPOSE_GET_SHARED_MEMBERS
102 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
103#endif
104
105private:
106 const std::unique_ptr<Details::SignedXmlImpl> m_impl;
107};
108
109}}}} // System::Security::Cryptography::Xml
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Facilitates creation of the XML signatures. Objects of this class should only be allocated using Syst...
Definition: reference.h:27
Used for XML signing and verification. Objects of this class should only be allocated using System::M...
Definition: signed_xml.h:30
static const String XmlDsigC14NTransformUrl
Definition: signed_xml.h:57
virtual SharedPtr< AsymmetricAlgorithm > GetPublicKey()
static const String XmlDsigSHA384Url
Definition: signed_xml.h:53
void AddReference(SharedPtr< Reference > reference)
static const String XmlDsigExcC14NWithCommentsTransformUrl
Definition: signed_xml.h:60
static const String XmlDsigRSASHA512Url
Definition: signed_xml.h:56
static const String XmlDsigXsltTransformUrl
Definition: signed_xml.h:63
static const String XmlDsigRSASHA256Url
Definition: signed_xml.h:52
SharedPtr< System::Xml::XmlElement > GetXml()
static const String XmlDecryptionTransformUrl
Definition: signed_xml.h:65
static const String XmlDsigNamespaceUrl
Definition: signed_xml.h:43
SharedPtr< Collections::ObjectModel::Collection< String > > get_SafeCanonicalizationMethods()
static const String XmlLicenseTransformUrl
Definition: signed_xml.h:66
SignedXml(SharedPtr< System::Xml::XmlElement > elem)
SharedPtr< AsymmetricAlgorithm > get_SigningKey()
static const String XmlDsigRSASHA384Url
Definition: signed_xml.h:54
void set_SigningKey(SharedPtr< AsymmetricAlgorithm > value)
static const String XmlDsigXPathTransformUrl
Definition: signed_xml.h:62
bool CheckSignatureReturningKey(SharedPtr< AsymmetricAlgorithm > &signingKey)
virtual SharedPtr< System::Xml::XmlElement > GetIdElement(SharedPtr< System::Xml::XmlDocument > document, String idValue)
static const String XmlDsigSHA512Url
Definition: signed_xml.h:55
static const String XmlDsigEnvelopedSignatureTransformUrl
Definition: signed_xml.h:64
static const String XmlDsigDSAUrl
Definition: signed_xml.h:48
static const String XmlDsigExcC14NTransformUrl
Definition: signed_xml.h:59
static const String XmlDsigC14NWithCommentsTransformUrl
Definition: signed_xml.h:58
static const String XmlDsigSHA256Url
Definition: signed_xml.h:51
void LoadXml(SharedPtr< System::Xml::XmlElement > value)
static const String XmlDsigCanonicalizationUrl
Definition: signed_xml.h:45
static const String XmlDsigRSASHA1Url
Definition: signed_xml.h:49
void AddObject(SharedPtr< DataObject > dataObject)
static const String XmlDsigSHA1Url
Definition: signed_xml.h:47
static const String XmlDsigBase64TransformUrl
Definition: signed_xml.h:61
static const String XmlDsigMinimalCanonicalizationUrl
Definition: signed_xml.h:44
static const String XmlDsigCanonicalizationWithCommentsUrl
Definition: signed_xml.h:46
void set_KeyInfo(SharedPtr< KeyInfo > value)
SignedXml(SharedPtr< System::Xml::XmlDocument > document)
bool CheckSignature(SharedPtr< AsymmetricAlgorithm > key)
static const String XmlDsigHMACSHA1Url
Definition: signed_xml.h:50
bool CheckSignature(SharedPtr< X509Certificates::X509Certificate2 > certificate, bool verifySignatureOnly)
Provides information about transforming the data by the signer. Objects of this class should only be ...
Definition: transform.h:31
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
@ Xml
Serialize according to the XML 1.0 rules.
Definition: db_command.h:9