У меня возникла следующая проблема, касающаяся XmlSerializer от Microsoft (c ++) и процесса десериализации. Подпись ds: не деиариализуется, и я получаю значение Undentified. Может кто-то заметить ошибку? Мой код выглядит следующим образом:
Мой xml следующий:
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<aa>
<version>0.1.1</version>
</aa>
<bb>
<cc>
<Id>134324321421</Id>
<ds:Signature>
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference Id="1" Type="" URI="something">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>43=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
4344
</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyValue>
<ds:RSAKeyValue>
<ds:Modulus>
4543434
</ds:Modulus>
<ds:Exponent>43</ds:Exponent>
</ds:RSAKeyValue>
</ds:KeyValue>
<ds:X509Data>
<ds:X509Certificate>
3454343243242
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
</cc>
</bb>
</aa>
И мой код выглядит следующим образом:
#using <mscorlib.dll>
#using <System.dll>
#using <System.Xml.dll>
//
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
//
using namespace System::Xml::Serialization;
using namespace System;
namespace ds{
ref class _KeyInfo;
ref class _KeyValue;
ref class _RSAKeyValue;
ref class _X509Data;
ref class _Reference;
ref class _Transforms;
ref class _Transform;
ref class _DigestMethod;
ref class _Signature;
ref class _SignedInfo;
ref class _CanonicalizationMethod;
ref class _SignatureMethod;/// <remarks/>
public ref class _KeyInfo {
private: _KeyValue^ keyValueField;
private: _X509Data^ x509DataField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("KeyValue", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _KeyValue^ KeyValue {
_KeyValue^ get();
System::Void set(_KeyValue^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("X509Data", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _X509Data^ X509Data {
_X509Data^ get();
System::Void set(_X509Data^ value);
}
};public ref class _KeyValue {
private: _RSAKeyValue^ rSAKeyValueField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("RSAKeyValue", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _RSAKeyValue^ RSAKeyValue {
_RSAKeyValue^ get();
System::Void set(_RSAKeyValue^ value);
}
};public ref class _RSAKeyValue {
private: System::String^ modulusField;
private: System::String^ exponentField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Modulus", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Modulus {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Exponent", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Exponent {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _X509Data {
private: System::String^ x509CertificateField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("X509Certificate", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ X509Certificate {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _Reference {
private: _Transforms^ transformsField;
private: _DigestMethod^ digestMethodField;
private: System::String^ digestValueField;
private: System::String^ idField;
private: System::String^ typeField;
private: System::String^ uRIField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Transforms", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _Transforms^ Transforms {
_Transforms^ get();
System::Void set(_Transforms^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _DigestMethod^ DigestMethod {
_DigestMethod^ get();
System::Void set(_DigestMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("DigestValue", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ DigestValue {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Id", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Id {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Type", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Type {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("URI", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ URI {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _Transforms {
private: _Transform^ transformField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Transform", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _Transform^ Transform {
_Transform^ get();
System::Void set(_Transform^ value);
}
};public ref class _Transform {
private: System::String^ algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Algorithm", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};
[System::Xml::Serialization::XmlRoot("DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig")]
public ref class _DigestMethod {
private: System::String ^algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Algorithm", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _SignedInfo {
private: _CanonicalizationMethod^ canonicalizationMethodField;
private: _SignatureMethod^ signatureMethodField;
private: _Reference^ referenceField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("CanonicalizationMethod", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _CanonicalizationMethod^ CanonicalizationMethod {
_CanonicalizationMethod^ get();
System::Void set(_CanonicalizationMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignatureMethod", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _SignatureMethod^ SignatureMethod {
_SignatureMethod^ get();
System::Void set(_SignatureMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Reference", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _Reference^ Reference {
_Reference^ get();
System::Void set(_Reference^ value);
}
};public ref class _CanonicalizationMethod {
private: System::String^ algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Algorithm", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _SignatureMethod {
private: System::String ^algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Algorithm", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class signature {
private: _SignedInfo^ signedInfoField;
private: System::String^ signatureValueField;
private: _KeyInfo^ keyInfoField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignedInfo", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _SignedInfo^ SignedInfo {
_SignedInfo^ get();
System::Void set(_SignedInfo^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignatureValue", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ SignatureValue {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("KeyInfo", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property _KeyInfo^ KeyInfo {
_KeyInfo^ get();
System::Void set(_KeyInfo^ value);
}
};inline _KeyValue^ _KeyInfo::KeyValue::get() {
return this->keyValueField;
}
inline System::Void _KeyInfo::KeyValue::set(_KeyValue^ value) {
this->keyValueField = value;
}
inline _X509Data^ _KeyInfo::X509Data::get() {
return this->x509DataField;
}
inline System::Void _KeyInfo::X509Data::set(_X509Data^ value) {
this->x509DataField = value;
}inline _RSAKeyValue^ _KeyValue::RSAKeyValue::get() {
return this->rSAKeyValueField;
}
inline System::Void _KeyValue::RSAKeyValue::set(_RSAKeyValue^ value) {
this->rSAKeyValueField = value;
}inline System::String^ _RSAKeyValue::Modulus::get() {
return this->modulusField;
}
inline System::Void _RSAKeyValue::Modulus::set(System::String^ value) {
this->modulusField = value;
}
inline System::String^ _RSAKeyValue::Exponent::get() {
return this->exponentField;
}
inline System::Void _RSAKeyValue::Exponent::set(System::String^ value) {
this->exponentField = value;
}inline System::String^ _X509Data::X509Certificate::get() {
return this->x509CertificateField;
}
inline System::Void _X509Data::X509Certificate::set(System::String^ value) {
this->x509CertificateField = value;
}inline _Transforms^ _Reference::Transforms::get() {
return this->transformsField;
}
inline System::Void _Reference::Transforms::set(_Transforms^ value) {
this->transformsField = value;
}
inline _DigestMethod^ _Reference::DigestMethod::get() {
return this->digestMethodField;
}
inline System::Void _Reference::DigestMethod::set(_DigestMethod^ value) {
this->digestMethodField = value;
}
inline System::String^ _Reference::DigestValue::get() {
return this->digestValueField;
}
inline System::Void _Reference::DigestValue::set(System::String^ value) {
this->digestValueField = value;
}
inline System::String^ _Reference::Id::get() {
return this->idField;
}
inline System::Void _Reference::Id::set(System::String^ value) {
this->idField = value;
}
inline System::String^ _Reference::Type::get() {
return this->typeField;
}
inline System::Void _Reference::Type::set(System::String^ value) {
this->typeField = value;
}
inline System::String^ _Reference::URI::get() {
return this->uRIField;
}
inline System::Void _Reference::URI::set(System::String^ value) {
this->uRIField = value;
}inline _Transform^ _Transforms::Transform::get() {
return this->transformField;
}
inline System::Void _Transforms::Transform::set(_Transform^ value) {
this->transformField = value;
}inline System::String^ _Transform::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _Transform::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline System::String^ _DigestMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _DigestMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline _SignedInfo^ signature::SignedInfo::get() {
return this->signedInfoField;
}
inline System::Void signature::SignedInfo::set(_SignedInfo^ value) {
this->signedInfoField = value;
}
inline System::String^ signature::SignatureValue::get() {
return this->signatureValueField;
}
inline System::Void signature::SignatureValue::set(System::String^ value) {
this->signatureValueField = value;
}
inline _KeyInfo^ signature::KeyInfo::get() {
return this->keyInfoField;
}
inline System::Void signature::KeyInfo::set(_KeyInfo^ value) {
this->keyInfoField = value;
}inline _CanonicalizationMethod^ _SignedInfo::CanonicalizationMethod::get() {
return this->canonicalizationMethodField;
}
inline System::Void _SignedInfo::CanonicalizationMethod::set(_CanonicalizationMethod^ value) {
this->canonicalizationMethodField = value;
}
inline _SignatureMethod^ _SignedInfo::SignatureMethod::get() {
return this->signatureMethodField;
}
inline System::Void _SignedInfo::SignatureMethod::set(_SignatureMethod^ value) {
this->signatureMethodField = value;
}
inline _Reference^ _SignedInfo::Reference::get() {
return this->referenceField;
}
inline System::Void _SignedInfo::Reference::set(_Reference^ value) {
this->referenceField = value;
}inline System::String^ _CanonicalizationMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _CanonicalizationMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline System::String^ _SignatureMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _SignatureMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}
};
///====================================================================================
public ref class AA{
public:
System::String^ version;
};
public ref class CC{
public:
System::String^ Id;
public: [System::Xml::Serialization::XmlElement("Signature", Namespace = "http://www.w3.org/2000/09/xmldsig")]
ds::signature^ Signature
};
public ref class BB{
public:
CC ^cc
};
[System::Xml::Serialization::XmlRoot("test", Namespace = "")]
public ref class test {
public:
AA ^aa;
BB ^bb;
};
//==============================================================================
NameTable^ nt = gcnew NameTable();
XmlNamespaceManager ^ namesp = gcnew XmlNamespaceManager (nt);
namesp->AddNamespace("ds", "http://www.w3.org/2000/09/xmldsig#");
XmlSerializer^ serializer = gcnew XmlSerializer( test::typeid, "http://www.w3.org/2000/09/xmldsig#");
// A FileStream is needed to read the XML document.
FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
XmlReader^ reader = gcnew XmlTextReader( fs,namesp->NameTable);
// Declare an object variable of the type to be deserialized.
test^ i;
// Use the Deserialize method to restore the object's state.
i = dynamic_cast<test^>(serializer->Deserialize( reader));
У вас есть несколько проблем здесь:
Пространство имен в XML http://www.w3.org/2000/09/xmldsig#
но в ваших украшениях атрибута c ++ вы пропускаете завершающий #
, например:
public: [System::Xml::Serialization::XmlElement("Signature", Namespace = "http://www.w3.org/2000/09/xmldsig")]
ds::signature^ Signature
Несоответствие пространства имен приводит к тому, что подпись не читается.
Несколько полей, которые вы украсили XmlElement
фактически отображаются как атрибуты в файле XML, и, следовательно, должны быть украшены XmlAttribute
, например:
public: [System::Xml::Serialization::XmlElement("Id", Namespace = "http://www.w3.org/2000/09/xmldsig")]
property System::String^ Id {
System::String^ get();
System::Void set(System::String^ value);
}
Кроме того, все поля, которые должны быть отмечены как атрибуты, также должны быть помещены в пустое пространство имен. Например, в строке <ds:Reference Id="1" Type="" URI="something">
, заметить, что Id
, Type
а также URI
делать не иметь ds:
префикс? Это означает, что они не находятся ни в каком пространстве имен.
После исправления этих проблем в приведенном ниже коде я могу прочитать предоставленный вами XML.
public ref class _KeyInfo {
private: _KeyValue^ keyValueField;
private: _X509Data^ x509DataField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("KeyValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _KeyValue^ KeyValue {
_KeyValue^ get();
System::Void set(_KeyValue^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("X509Data", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _X509Data^ X509Data {
_X509Data^ get();
System::Void set(_X509Data^ value);
}
};public ref class _KeyValue {
private: _RSAKeyValue^ rSAKeyValueField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("RSAKeyValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _RSAKeyValue^ RSAKeyValue {
_RSAKeyValue^ get();
System::Void set(_RSAKeyValue^ value);
}
};public ref class _RSAKeyValue {
private: System::String^ modulusField;
private: System::String^ exponentField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Modulus", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property System::String^ Modulus {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Exponent", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property System::String^ Exponent {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _X509Data {
private: System::String^ x509CertificateField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("X509Certificate", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property System::String^ X509Certificate {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _Reference {
private: _Transforms^ transformsField;
private: _DigestMethod^ digestMethodField;
private: System::String^ digestValueField;
private: System::String^ idField;
private: System::String^ typeField;
private: System::String^ uRIField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Transforms", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _Transforms^ Transforms {
_Transforms^ get();
System::Void set(_Transforms^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _DigestMethod^ DigestMethod {
_DigestMethod^ get();
System::Void set(_DigestMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("DigestValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property System::String^ DigestValue {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Id", Namespace = "")]
property System::String^ Id {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Type", Namespace = "")]
property System::String^ Type {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("URI", Namespace = "")]
property System::String^ URI {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _Transforms {
private: _Transform^ transformField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Transform", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _Transform^ Transform {
_Transform^ get();
System::Void set(_Transform^ value);
}
};public ref class _Transform {
private: System::String^ algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Algorithm", Namespace = "")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};
[System::Xml::Serialization::XmlRoot("DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
public ref class _DigestMethod {
private: System::String ^algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Algorithm", Namespace = "")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _SignedInfo {
private: _CanonicalizationMethod^ canonicalizationMethodField;
private: _SignatureMethod^ signatureMethodField;
private: _Reference^ referenceField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("CanonicalizationMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _CanonicalizationMethod^ CanonicalizationMethod {
_CanonicalizationMethod^ get();
System::Void set(_CanonicalizationMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignatureMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _SignatureMethod^ SignatureMethod {
_SignatureMethod^ get();
System::Void set(_SignatureMethod^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("Reference", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _Reference^ Reference {
_Reference^ get();
System::Void set(_Reference^ value);
}
};public ref class _CanonicalizationMethod {
private: System::String^ algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Algorithm", Namespace = "")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class _SignatureMethod {
private: System::String ^algorithmField;
/// <remarks/>
public: [System::Xml::Serialization::XmlAttribute("Algorithm", Namespace = "")]
property System::String^ Algorithm {
System::String^ get();
System::Void set(System::String^ value);
}
};public ref class signature {
private: _SignedInfo^ signedInfoField;
private: System::String^ signatureValueField;
private: _KeyInfo^ keyInfoField;
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignedInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _SignedInfo^ SignedInfo {
_SignedInfo^ get();
System::Void set(_SignedInfo^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("SignatureValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property System::String^ SignatureValue {
System::String^ get();
System::Void set(System::String^ value);
}
/// <remarks/>
public: [System::Xml::Serialization::XmlElement("KeyInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
property _KeyInfo^ KeyInfo {
_KeyInfo^ get();
System::Void set(_KeyInfo^ value);
}
};inline _KeyValue^ _KeyInfo::KeyValue::get() {
return this->keyValueField;
}
inline System::Void _KeyInfo::KeyValue::set(_KeyValue^ value) {
this->keyValueField = value;
}
inline _X509Data^ _KeyInfo::X509Data::get() {
return this->x509DataField;
}
inline System::Void _KeyInfo::X509Data::set(_X509Data^ value) {
this->x509DataField = value;
}inline _RSAKeyValue^ _KeyValue::RSAKeyValue::get() {
return this->rSAKeyValueField;
}
inline System::Void _KeyValue::RSAKeyValue::set(_RSAKeyValue^ value) {
this->rSAKeyValueField = value;
}inline System::String^ _RSAKeyValue::Modulus::get() {
return this->modulusField;
}
inline System::Void _RSAKeyValue::Modulus::set(System::String^ value) {
this->modulusField = value;
}
inline System::String^ _RSAKeyValue::Exponent::get() {
return this->exponentField;
}
inline System::Void _RSAKeyValue::Exponent::set(System::String^ value) {
this->exponentField = value;
}inline System::String^ _X509Data::X509Certificate::get() {
return this->x509CertificateField;
}
inline System::Void _X509Data::X509Certificate::set(System::String^ value) {
this->x509CertificateField = value;
}inline _Transforms^ _Reference::Transforms::get() {
return this->transformsField;
}
inline System::Void _Reference::Transforms::set(_Transforms^ value) {
this->transformsField = value;
}
inline _DigestMethod^ _Reference::DigestMethod::get() {
return this->digestMethodField;
}
inline System::Void _Reference::DigestMethod::set(_DigestMethod^ value) {
this->digestMethodField = value;
}
inline System::String^ _Reference::DigestValue::get() {
return this->digestValueField;
}
inline System::Void _Reference::DigestValue::set(System::String^ value) {
this->digestValueField = value;
}
inline System::String^ _Reference::Id::get() {
return this->idField;
}
inline System::Void _Reference::Id::set(System::String^ value) {
this->idField = value;
}
inline System::String^ _Reference::Type::get() {
return this->typeField;
}
inline System::Void _Reference::Type::set(System::String^ value) {
this->typeField = value;
}
inline System::String^ _Reference::URI::get() {
return this->uRIField;
}
inline System::Void _Reference::URI::set(System::String^ value) {
this->uRIField = value;
}inline _Transform^ _Transforms::Transform::get() {
return this->transformField;
}
inline System::Void _Transforms::Transform::set(_Transform^ value) {
this->transformField = value;
}inline System::String^ _Transform::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _Transform::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline System::String^ _DigestMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _DigestMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline _SignedInfo^ signature::SignedInfo::get() {
return this->signedInfoField;
}
inline System::Void signature::SignedInfo::set(_SignedInfo^ value) {
this->signedInfoField = value;
}
inline System::String^ signature::SignatureValue::get() {
return this->signatureValueField;
}
inline System::Void signature::SignatureValue::set(System::String^ value) {
this->signatureValueField = value;
}
inline _KeyInfo^ signature::KeyInfo::get() {
return this->keyInfoField;
}
inline System::Void signature::KeyInfo::set(_KeyInfo^ value) {
this->keyInfoField = value;
}inline _CanonicalizationMethod^ _SignedInfo::CanonicalizationMethod::get() {
return this->canonicalizationMethodField;
}
inline System::Void _SignedInfo::CanonicalizationMethod::set(_CanonicalizationMethod^ value) {
this->canonicalizationMethodField = value;
}
inline _SignatureMethod^ _SignedInfo::SignatureMethod::get() {
return this->signatureMethodField;
}
inline System::Void _SignedInfo::SignatureMethod::set(_SignatureMethod^ value) {
this->signatureMethodField = value;
}
inline _Reference^ _SignedInfo::Reference::get() {
return this->referenceField;
}
inline System::Void _SignedInfo::Reference::set(_Reference^ value) {
this->referenceField = value;
}inline System::String^ _CanonicalizationMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _CanonicalizationMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}inline System::String^ _SignatureMethod::Algorithm::get() {
return this->algorithmField;
}
inline System::Void _SignatureMethod::Algorithm::set(System::String^ value) {
this->algorithmField = value;
}
};
///====================================================================================
public ref class AA{
public:
System::String^ version;
};
public ref class CC{
public:
System::String^ Id;
public: [System::Xml::Serialization::XmlElement("Signature", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
ds::signature^ Signature;
};
public ref class BB{
public:
CC ^cc;
};
[System::Xml::Serialization::XmlRoot("test", Namespace = "")]
public ref class test {
public:
AA ^aa;
BB ^bb;
};
В будущем одним из способов проверить свою работу было бы использование xsd.exe
создать классы C # для вашего XML, затем сравните автоматически сгенерированные классы c # с вашими вручную созданными классами c ++. Вы, вероятно, видели проблему.