xmldsign 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  Makefile
19
+ xmldsign_ext.bundle
@@ -4,17 +4,9 @@
4
4
  #define O_BINARY 0
5
5
  #endif
6
6
 
7
- char* substring(const char* str, size_t begin, size_t len)
7
+ int digest(char * data, byte * sum)
8
8
  {
9
- if (str == 0 || strlen(str) == 0 || strlen(str) < begin || strlen(str) < (begin+len))
10
- return 0;
11
-
12
- return strndup(str + begin, len);
13
- }
14
-
15
- int digest(char * data, char * sum)
16
- {
17
- gost_subst_block *b= &GostR3411_94_CryptoProParamSet;
9
+ gost_subst_block *b= &GostR3411_94_CryptoProParamSet;
18
10
  gost_hash_ctx ctx;
19
11
 
20
12
  init_gost_hash_ctx(&ctx, b);
@@ -27,7 +19,7 @@ int digest(char * data, char * sum)
27
19
  return 0;
28
20
  }
29
21
 
30
- int hash_data(gost_hash_ctx *ctx, const char *data, char *sum)
22
+ int hash_data(gost_hash_ctx *ctx, const char *data, byte *sum)
31
23
  {
32
24
  int i;
33
25
  size_t bytes = strlen(data);
@@ -42,16 +34,12 @@ int hash_data(gost_hash_ctx *ctx, const char *data, char *sum)
42
34
  return 1;
43
35
  }
44
36
 
45
- static VALUE rb_gost_digest(VALUE self)
37
+ static VALUE rb_gost_digest(VALUE self, VALUE data)
46
38
  {
47
- char sum[32];
48
-
49
- VALUE data;
50
-
51
- data = rb_iv_get(self, "@data");
39
+ byte sum[32];
52
40
 
53
41
  if( digest(StringValuePtr(data), sum) )
54
- return rb_str_new2( substring(sum, 0, 32) );
42
+ return rb_str_new( sum, 32 );
55
43
  else
56
44
  return Qfalse;
57
45
  }
@@ -62,5 +50,5 @@ void Init_xmldsign_ext() {
62
50
  mDigests = rb_define_module_under(mXmldsign, "Digests");
63
51
  cGost = rb_define_class_under(mDigests, "Gost", rb_cObject);
64
52
 
65
- rb_define_method(cGost, "binary", rb_gost_digest, 0);
53
+ rb_define_method(cGost, "binary", rb_gost_digest, 1);
66
54
  }
@@ -12,6 +12,9 @@ module Xmldsign
12
12
  def hex(data)
13
13
  new(data).hex
14
14
  end
15
+ def binary(data)
16
+ new(data).binary
17
+ end
15
18
  end
16
19
 
17
20
  def initialize(data)
@@ -19,11 +22,11 @@ module Xmldsign
19
22
  end
20
23
 
21
24
  def base64
22
- Base64.encode64(binary).strip
25
+ Base64.strict_encode64(binary(data))
23
26
  end
24
27
 
25
28
  def hex
26
- binary.bytes.inject("") { |hex, b| hex << b.to_s(16) }
29
+ binary(data).bytes.inject("") { |hex, b| hex << b.to_s(16) }
27
30
  end
28
31
  end
29
32
  end
@@ -1,3 +1,3 @@
1
1
  module Xmldsign
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,182 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <doc:signedActRecordBirth xmlns:doc="http://ezags.rt.ru/type/document/" xmlns:com="http://ezags.rt.ru/type/common/" xmlns:act="http://ezags.rt.ru/type/actor/" xmlns:ext="http://ezags.rt.ru/type/externaldocuments/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
3
+ <doc:actRecord>
4
+ <com:registrarId>260001</com:registrarId>
5
+ <com:actRecordUID>000000000000000000005</com:actRecordUID>
6
+ <com:actRecordNumber>1</com:actRecordNumber>
7
+ <com:actRecordDate>
8
+ <com:day>9</com:day>
9
+ <com:month>11</com:month>
10
+ <com:year>2012</com:year>
11
+ </com:actRecordDate>
12
+ <doc:otherInformationAndOfficialAnnotations>
13
+ <com:otherInformationAndOfficialAnnotationsItem>Other Information</com:otherInformationAndOfficialAnnotationsItem>
14
+ </doc:otherInformationAndOfficialAnnotations>
15
+ <com:certNumber>100010</com:certNumber>
16
+ <com:certSeries>II-ЩФ</com:certSeries>
17
+ <doc:content>
18
+ <com:birthStatus>liveborn</com:birthStatus>
19
+ <com:isDiedInWeek>false</com:isDiedInWeek>
20
+ <com:numberOfBirths>1</com:numberOfBirths>
21
+ </doc:content>
22
+ <doc:participants>
23
+ <doc:child>
24
+ <com:surname>Уваров</com:surname>
25
+ <com:firstName>Николай</com:firstName>
26
+ <com:patronymic>Иванович</com:patronymic>
27
+ <com:gender>male</com:gender>
28
+ <com:birthDate>
29
+ <com:preciseDate>2012-04-01</com:preciseDate>
30
+ </com:birthDate>
31
+ <com:birthPlace>
32
+ <com:okatoCode>12345678910</com:okatoCode>
33
+ <com:countryCode>1</com:countryCode>
34
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
35
+ <com:kladrCode>1234567891013</com:kladrCode>
36
+ </com:birthPlace>
37
+ </doc:child>
38
+ <doc:father>
39
+ <com:isApplicant>false</com:isApplicant>
40
+ <com:surname>Уваров</com:surname>
41
+ <com:firstName>Иван</com:firstName>
42
+ <com:patronymic>Сергеевич</com:patronymic>
43
+ <com:gender>male</com:gender>
44
+ <com:birthDate>
45
+ <com:preciseDate>1972-05-20</com:preciseDate>
46
+ </com:birthDate>
47
+ <com:birthPlace>
48
+ <com:okatoCode>12345678910</com:okatoCode>
49
+ <com:countryCode>1</com:countryCode>
50
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
51
+ <com:kladrCode>1234567891013</com:kladrCode>
52
+ </com:birthPlace>
53
+ <com:citizenship>1</com:citizenship>
54
+ <com:nationality>1</com:nationality>
55
+ <com:residencePlace>
56
+ <com:okatoCode>12345678910</com:okatoCode>
57
+ <com:countryCode>1</com:countryCode>
58
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп. 22, кв 22</com:rawAddressString>
59
+ <com:kladrCode>1234567891013</com:kladrCode>
60
+ <com:house>1</com:house>
61
+ <com:building>1</com:building>
62
+ <com:appartment>1</com:appartment>
63
+ </com:residencePlace>
64
+ <com:snils>111-111-111 11</com:snils>
65
+ </doc:father>
66
+ <doc:mother>
67
+ <com:isApplicant>false</com:isApplicant>
68
+ <com:surname>Уварова</com:surname>
69
+ <com:firstName>Марина</com:firstName>
70
+ <com:patronymic>Дмитриевна</com:patronymic>
71
+ <com:gender>female</com:gender>
72
+ <com:birthDate>
73
+ <com:preciseDate>1980-05-06</com:preciseDate>
74
+ </com:birthDate>
75
+ <com:birthPlace>
76
+ <com:okatoCode>12345678910</com:okatoCode>
77
+ <com:countryCode>1</com:countryCode>
78
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
79
+ <com:kladrCode>1234567891013</com:kladrCode>
80
+ </com:birthPlace>
81
+ <com:citizenship>1</com:citizenship>
82
+ <com:nationality>1</com:nationality>
83
+ <com:residencePlace>
84
+ <com:okatoCode>12345678910</com:okatoCode>
85
+ <com:countryCode>1</com:countryCode>
86
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп. 22, кв 22</com:rawAddressString>
87
+ <com:kladrCode>1234567891013</com:kladrCode>
88
+ <com:house>1</com:house>
89
+ <com:building>1</com:building>
90
+ <com:appartment>1</com:appartment>
91
+ </com:residencePlace>
92
+ <com:snils>111-111-111 11</com:snils>
93
+ </doc:mother>
94
+ </doc:participants>
95
+ <doc:documentConfirmingBirth>
96
+ <ext:medicalCertificateOfBirthByOrganization>
97
+ <com:documentNumber>111111</com:documentNumber>
98
+ <com:documentSeries>111</com:documentSeries>
99
+ <com:documentDate>2012-05-20</com:documentDate>
100
+ <com:organizationName>OrganizationName</com:organizationName>
101
+ <com:organizationAddress>
102
+ <com:okatoCode>12345678910</com:okatoCode>
103
+ <com:countryCode>1</com:countryCode>
104
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шуриковская, д.10</com:rawAddressString>
105
+ <com:kladrCode>1234567891013</com:kladrCode>
106
+ </com:organizationAddress>
107
+ <com:okpo>1</com:okpo>
108
+ <com:duplicate>false</com:duplicate>
109
+ </ext:medicalCertificateOfBirthByOrganization>
110
+ </doc:documentConfirmingBirth>
111
+ <doc:documentConfirmingFiliation>
112
+ <doc:actRecAndCertMarriageRequisites>
113
+ <doc:actRecordMarriageReqs>
114
+ <com:registrarId>260001</com:registrarId>
115
+ <com:actRecordNumber>1</com:actRecordNumber>
116
+ <com:actRecordDate>
117
+ <com:day>12</com:day>
118
+ <com:month>5</com:month>
119
+ <com:year>2012</com:year>
120
+ </com:actRecordDate>
121
+ </doc:actRecordMarriageReqs>
122
+ <doc:certificateMarriageReqs>
123
+ <com:registrarId>260001</com:registrarId>
124
+ <com:certNumber>111111</com:certNumber>
125
+ <com:documentDate>1972-05-20</com:documentDate>
126
+ <com:certSeries>111</com:certSeries>
127
+ </doc:certificateMarriageReqs>
128
+ </doc:actRecAndCertMarriageRequisites>
129
+ </doc:documentConfirmingFiliation>
130
+ <doc:otherApplicants>
131
+ <doc:applicantPerson>
132
+ <com:isApplicant>true</com:isApplicant>
133
+ <com:surname>Уваров</com:surname>
134
+ <com:firstName>Иван</com:firstName>
135
+ <com:patronymic>Сергеевич</com:patronymic>
136
+ <com:birthDate>
137
+ <com:preciseDate>1972-05-20</com:preciseDate>
138
+ </com:birthDate>
139
+ <com:residencePlace>
140
+ <com:okatoCode>12345678910</com:okatoCode>
141
+ <com:countryCode>1</com:countryCode>
142
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп. 22, кв 22</com:rawAddressString>
143
+ <com:kladrCode>1234567891013</com:kladrCode>
144
+ <com:house>1</com:house>
145
+ <com:building>1</com:building>
146
+ <com:appartment>1</com:appartment>
147
+ </com:residencePlace>
148
+ <com:identityDocument>
149
+ <com:documentType>904</com:documentType>
150
+ <com:documentNumber>111111</com:documentNumber>
151
+ <com:organizationName>OrganizationName</com:organizationName>
152
+ <com:documentDate>2012-05-20</com:documentDate>
153
+ </com:identityDocument>
154
+ </doc:applicantPerson>
155
+ </doc:otherApplicants>
156
+ </doc:actRecord>
157
+ <doc:actRecordSignature>
158
+ <ds:Signature>
159
+ <ds:SignedInfo>
160
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
161
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"/>
162
+ <ds:Reference URI="">
163
+ <ds:Transforms>
164
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
165
+ <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116">
166
+ <xslt:stylesheet xmlns:xslt="http://www.w3.org/1999/XSL/Transform" version="1.0"><xslt:output method="xml" omit-xml-declaration="yes"/><xslt:strip-space elements="*"/><xslt:template match="@*|node()"><xslt:copy><xslt:apply-templates select="@*|node()"/></xslt:copy></xslt:template></xslt:stylesheet>
167
+ </ds:Transform>
168
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
169
+ </ds:Transforms>
170
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#gostr3411"/>
171
+ <ds:DigestValue>bG9ydW0gaXBzdW0=</ds:DigestValue>
172
+ </ds:Reference>
173
+ </ds:SignedInfo>
174
+ <ds:SignatureValue>bG9ydW0gaXBzdW0=</ds:SignatureValue>
175
+ <ds:KeyInfo>
176
+ <ds:X509Data>
177
+ <ds:X509Certificate>bG9ydW0gaXBzdW0=</ds:X509Certificate>
178
+ </ds:X509Data>
179
+ </ds:KeyInfo>
180
+ </ds:Signature>
181
+ </doc:actRecordSignature>
182
+ </doc:signedActRecordBirth>
@@ -0,0 +1,167 @@
1
+ <doc:signedActRecordBirth xmlns:doc="http://ezags.rt.ru/type/document/">
2
+ <doc:actRecord>
3
+ <com:registrarId xmlns:com="http://ezags.rt.ru/type/common/">260001</com:registrarId>
4
+ <com:actRecordUID xmlns:com="http://ezags.rt.ru/type/common/">000000000000000000002</com:actRecordUID>
5
+ <com:actRecordNumber xmlns:com="http://ezags.rt.ru/type/common/">1</com:actRecordNumber>
6
+ <com:actRecordDate xmlns:com="http://ezags.rt.ru/type/common/">
7
+ <com:day>9</com:day>
8
+ <com:month>11</com:month>
9
+ <com:year>2012</com:year>
10
+ </com:actRecordDate>
11
+ <doc:otherInformationAndOfficialAnnotations>
12
+ <com:otherInformationAndOfficialAnnotationsItem xmlns:com="http://ezags.rt.ru/type/common/">Other
13
+ Information
14
+ </com:otherInformationAndOfficialAnnotationsItem>
15
+ </doc:otherInformationAndOfficialAnnotations>
16
+ <com:certNumber xmlns:com="http://ezags.rt.ru/type/common/">100004</com:certNumber>
17
+ <com:certSeries xmlns:com="http://ezags.rt.ru/type/common/">II-ЩФ</com:certSeries>
18
+ <doc:content>
19
+ <com:birthStatus xmlns:com="http://ezags.rt.ru/type/common/">liveborn</com:birthStatus>
20
+ <com:isDiedInWeek xmlns:com="http://ezags.rt.ru/type/common/">false</com:isDiedInWeek>
21
+ <com:numberOfBirths xmlns:com="http://ezags.rt.ru/type/common/">1</com:numberOfBirths>
22
+ </doc:content>
23
+ <doc:participants>
24
+ <doc:child>
25
+ <com:surname xmlns:com="http://ezags.rt.ru/type/common/">Уваров</com:surname>
26
+ <com:firstName xmlns:com="http://ezags.rt.ru/type/common/">Николай</com:firstName>
27
+ <com:patronymic xmlns:com="http://ezags.rt.ru/type/common/">Иванович</com:patronymic>
28
+ <com:gender xmlns:com="http://ezags.rt.ru/type/common/">male</com:gender>
29
+ <com:birthDate xmlns:com="http://ezags.rt.ru/type/common/">
30
+ <com:preciseDate>2012-04-01</com:preciseDate>
31
+ </com:birthDate>
32
+ <com:birthPlace xmlns:com="http://ezags.rt.ru/type/common/">
33
+ <com:okatoCode>12345678910</com:okatoCode>
34
+ <com:countryCode>1</com:countryCode>
35
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
36
+ <com:kladrCode>1234567891013</com:kladrCode>
37
+ </com:birthPlace>
38
+ </doc:child>
39
+ <doc:father>
40
+ <com:isApplicant xmlns:com="http://ezags.rt.ru/type/common/">false</com:isApplicant>
41
+ <com:surname xmlns:com="http://ezags.rt.ru/type/common/">Уваров</com:surname>
42
+ <com:firstName xmlns:com="http://ezags.rt.ru/type/common/">Иван</com:firstName>
43
+ <com:patronymic xmlns:com="http://ezags.rt.ru/type/common/">Сергеевич</com:patronymic>
44
+ <com:gender xmlns:com="http://ezags.rt.ru/type/common/">male</com:gender>
45
+ <com:birthDate xmlns:com="http://ezags.rt.ru/type/common/">
46
+ <com:preciseDate>1972-05-20</com:preciseDate>
47
+ </com:birthDate>
48
+ <com:birthPlace xmlns:com="http://ezags.rt.ru/type/common/">
49
+ <com:okatoCode>12345678910</com:okatoCode>
50
+ <com:countryCode>1</com:countryCode>
51
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
52
+ <com:kladrCode>1234567891013</com:kladrCode>
53
+ </com:birthPlace>
54
+ <com:citizenship xmlns:com="http://ezags.rt.ru/type/common/">1</com:citizenship>
55
+ <com:nationality xmlns:com="http://ezags.rt.ru/type/common/">1</com:nationality>
56
+ <com:residencePlace xmlns:com="http://ezags.rt.ru/type/common/">
57
+ <com:okatoCode>12345678910</com:okatoCode>
58
+ <com:countryCode>1</com:countryCode>
59
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп.
60
+ 22, кв 22
61
+ </com:rawAddressString>
62
+ <com:kladrCode>1234567891013</com:kladrCode>
63
+ <com:house>1</com:house>
64
+ <com:building>1</com:building>
65
+ <com:appartment>1</com:appartment>
66
+ </com:residencePlace>
67
+ <com:snils xmlns:com="http://ezags.rt.ru/type/common/">111-111-111 11</com:snils>
68
+ </doc:father>
69
+ <doc:mother>
70
+ <com:isApplicant xmlns:com="http://ezags.rt.ru/type/common/">false</com:isApplicant>
71
+ <com:surname xmlns:com="http://ezags.rt.ru/type/common/">Уварова</com:surname>
72
+ <com:firstName xmlns:com="http://ezags.rt.ru/type/common/">Марина</com:firstName>
73
+ <com:patronymic xmlns:com="http://ezags.rt.ru/type/common/">Дмитриевна</com:patronymic>
74
+ <com:gender xmlns:com="http://ezags.rt.ru/type/common/">female</com:gender>
75
+ <com:birthDate xmlns:com="http://ezags.rt.ru/type/common/">
76
+ <com:preciseDate>1980-05-06</com:preciseDate>
77
+ </com:birthDate>
78
+ <com:birthPlace xmlns:com="http://ezags.rt.ru/type/common/">
79
+ <com:okatoCode>12345678910</com:okatoCode>
80
+ <com:countryCode>1</com:countryCode>
81
+ <com:rawAddressString>город Ставрополь, Ставрополький край, Россия</com:rawAddressString>
82
+ <com:kladrCode>1234567891013</com:kladrCode>
83
+ </com:birthPlace>
84
+ <com:citizenship xmlns:com="http://ezags.rt.ru/type/common/">1</com:citizenship>
85
+ <com:nationality xmlns:com="http://ezags.rt.ru/type/common/">1</com:nationality>
86
+ <com:residencePlace xmlns:com="http://ezags.rt.ru/type/common/">
87
+ <com:okatoCode>12345678910</com:okatoCode>
88
+ <com:countryCode>1</com:countryCode>
89
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп.
90
+ 22, кв 22
91
+ </com:rawAddressString>
92
+ <com:kladrCode>1234567891013</com:kladrCode>
93
+ <com:house>1</com:house>
94
+ <com:building>1</com:building>
95
+ <com:appartment>1</com:appartment>
96
+ </com:residencePlace>
97
+ <com:snils xmlns:com="http://ezags.rt.ru/type/common/">111-111-111 11</com:snils>
98
+ </doc:mother>
99
+ </doc:participants>
100
+ <doc:documentConfirmingBirth>
101
+ <ext:medicalCertificateOfBirthByOrganization xmlns:ext="http://ezags.rt.ru/type/externaldocuments/">
102
+ <com:documentNumber xmlns:com="http://ezags.rt.ru/type/common/">111111</com:documentNumber>
103
+ <com:documentSeries xmlns:com="http://ezags.rt.ru/type/common/">111</com:documentSeries>
104
+ <com:documentDate xmlns:com="http://ezags.rt.ru/type/common/">2012-05-20</com:documentDate>
105
+ <com:organizationName xmlns:com="http://ezags.rt.ru/type/common/">OrganizationName
106
+ </com:organizationName>
107
+ <com:organizationAddress xmlns:com="http://ezags.rt.ru/type/common/">
108
+ <com:okatoCode>12345678910</com:okatoCode>
109
+ <com:countryCode>1</com:countryCode>
110
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шуриковская, д.10
111
+ </com:rawAddressString>
112
+ <com:kladrCode>1234567891013</com:kladrCode>
113
+ </com:organizationAddress>
114
+ <com:okpo xmlns:com="http://ezags.rt.ru/type/common/">1</com:okpo>
115
+ <com:duplicate xmlns:com="http://ezags.rt.ru/type/common/">false</com:duplicate>
116
+ </ext:medicalCertificateOfBirthByOrganization>
117
+ </doc:documentConfirmingBirth>
118
+ <doc:documentConfirmingFiliation>
119
+ <doc:actRecAndCertMarriageRequisites>
120
+ <doc:actRecordMarriageReqs>
121
+ <com:registrarId xmlns:com="http://ezags.rt.ru/type/common/">260001</com:registrarId>
122
+ <com:actRecordNumber xmlns:com="http://ezags.rt.ru/type/common/">1</com:actRecordNumber>
123
+ <com:actRecordDate xmlns:com="http://ezags.rt.ru/type/common/">
124
+ <com:day>12</com:day>
125
+ <com:month>5</com:month>
126
+ <com:year>2012</com:year>
127
+ </com:actRecordDate>
128
+ </doc:actRecordMarriageReqs>
129
+ <doc:certificateMarriageReqs>
130
+ <com:registrarId xmlns:com="http://ezags.rt.ru/type/common/">260001</com:registrarId>
131
+ <com:certNumber xmlns:com="http://ezags.rt.ru/type/common/">111111</com:certNumber>
132
+ <com:documentDate xmlns:com="http://ezags.rt.ru/type/common/">1972-05-20</com:documentDate>
133
+ <com:certSeries xmlns:com="http://ezags.rt.ru/type/common/">111</com:certSeries>
134
+ </doc:certificateMarriageReqs>
135
+ </doc:actRecAndCertMarriageRequisites>
136
+ </doc:documentConfirmingFiliation>
137
+ <doc:otherApplicants>
138
+ <doc:applicantPerson>
139
+ <com:isApplicant xmlns:com="http://ezags.rt.ru/type/common/">true</com:isApplicant>
140
+ <com:surname xmlns:com="http://ezags.rt.ru/type/common/">Уваров</com:surname>
141
+ <com:firstName xmlns:com="http://ezags.rt.ru/type/common/">Иван</com:firstName>
142
+ <com:patronymic xmlns:com="http://ezags.rt.ru/type/common/">Сергеевич</com:patronymic>
143
+ <com:birthDate xmlns:com="http://ezags.rt.ru/type/common/">
144
+ <com:preciseDate>1972-05-20</com:preciseDate>
145
+ </com:birthDate>
146
+ <com:residencePlace xmlns:com="http://ezags.rt.ru/type/common/">
147
+ <com:okatoCode>12345678910</com:okatoCode>
148
+ <com:countryCode>1</com:countryCode>
149
+ <com:rawAddressString>город Ставрополь, Ставропольский край, Россия, улица Шпаковская, д.22, корп.
150
+ 22, кв 22
151
+ </com:rawAddressString>
152
+ <com:kladrCode>1234567891013</com:kladrCode>
153
+ <com:house>1</com:house>
154
+ <com:building>1</com:building>
155
+ <com:appartment>1</com:appartment>
156
+ </com:residencePlace>
157
+ <com:identityDocument xmlns:com="http://ezags.rt.ru/type/common/">
158
+ <com:documentType>904</com:documentType>
159
+ <com:documentNumber>111111</com:documentNumber>
160
+ <com:organizationName>OrganizationName</com:organizationName>
161
+ <com:documentDate>2012-05-20</com:documentDate>
162
+ </com:identityDocument>
163
+ </doc:applicantPerson>
164
+ </doc:otherApplicants>
165
+ </doc:actRecord>
166
+ <doc:actRecordSignature></doc:actRecordSignature>
167
+ </doc:signedActRecordBirth>
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Xmldsign do
4
4
  LibXML::XML.default_pedantic_parser = true
5
- LibXML::XML.indent_tree_output = false
5
+ LibXML::XML.indent_tree_output = false
6
6
  subject { Xmldsign::Document.string asset('act-birth-for-sign.xml') }
7
7
 
8
8
  it "should execute transformations" do
@@ -21,4 +21,30 @@ describe Xmldsign do
21
21
  subject.signature.c14n_signed_info.should eql asset('signed-info-for-act-birth.xml').strip
22
22
  end
23
23
 
24
+ it "should sign all xml in assets" do
25
+ assets = %w(signed-act-birth-with-comment.xml
26
+ signed-act-birth.xml
27
+ signed-act-changed-ns-order.xml
28
+ signed-act-changed-prefixes.xml
29
+ signed-act-changed-xml-comments.xml
30
+ signed-act-death-with-empty-tags.xml
31
+ signed-act-death.xml
32
+ signed.test.xml
33
+ null-pointer.xml)
34
+
35
+ assets.each do |name|
36
+ xml = Xmldsign::Document.string asset name
37
+ xml.signature.sign
38
+
39
+ xml = Xmldsign::Document.string asset name
40
+ xml.signature.calculate_digest
41
+
42
+ xml = Xmldsign::Document.string asset name
43
+ xml.signature.fill_digest!
44
+ end
45
+
46
+ #Xmldsign::Document.string asset 'transformed.xml'
47
+ xml = Xmldsign::Document.string asset 'null-pointer.xml'
48
+ xml.signature.calculate_digest.should eql 'lnQAJP6l90PT5WyCn37XOH1iayU4j5MjF2cpCzwWgBc='
49
+ end
24
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmldsign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-09 00:00:00.000000000 Z
12
+ date: 2012-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby
@@ -148,7 +148,6 @@ files:
148
148
  - ext/xmldsign/gost89.h
149
149
  - ext/xmldsign/gosthash.c
150
150
  - ext/xmldsign/gosthash.h
151
- - ext/xmldsign/xmldsign_ext.bundle
152
151
  - ext/xmldsign/xmldsign_ext.c
153
152
  - ext/xmldsign/xmldsign_ext.h
154
153
  - lib/xmldsign.rb
@@ -165,6 +164,7 @@ files:
165
164
  - spec/assets/act-death-for-sign.xml
166
165
  - spec/assets/act-death-with-empty-tags-for-sign.xml
167
166
  - spec/assets/csr.pem
167
+ - spec/assets/null-pointer.xml
168
168
  - spec/assets/private.key.pem
169
169
  - spec/assets/private.passw.key.pem
170
170
  - spec/assets/public.key.pem
@@ -186,6 +186,7 @@ files:
186
186
  - spec/assets/signed-act-wrong-transxslt-alg.xml
187
187
  - spec/assets/signed-info-for-act-birth.xml
188
188
  - spec/assets/signed.test.xml
189
+ - spec/assets/transformed.xml
189
190
  - spec/assets/unsigned.test.xml
190
191
  - spec/assets/x509.crt
191
192
  - spec/spec_helper.rb
@@ -205,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
206
  version: '0'
206
207
  segments:
207
208
  - 0
208
- hash: -2220391604931864597
209
+ hash: 1771735899723035723
209
210
  required_rubygems_version: !ruby/object:Gem::Requirement
210
211
  none: false
211
212
  requirements:
@@ -214,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
215
  version: '0'
215
216
  segments:
216
217
  - 0
217
- hash: -2220391604931864597
218
+ hash: 1771735899723035723
218
219
  requirements: []
219
220
  rubyforge_project:
220
221
  rubygems_version: 1.8.24
@@ -227,6 +228,7 @@ test_files:
227
228
  - spec/assets/act-death-for-sign.xml
228
229
  - spec/assets/act-death-with-empty-tags-for-sign.xml
229
230
  - spec/assets/csr.pem
231
+ - spec/assets/null-pointer.xml
230
232
  - spec/assets/private.key.pem
231
233
  - spec/assets/private.passw.key.pem
232
234
  - spec/assets/public.key.pem
@@ -248,6 +250,7 @@ test_files:
248
250
  - spec/assets/signed-act-wrong-transxslt-alg.xml
249
251
  - spec/assets/signed-info-for-act-birth.xml
250
252
  - spec/assets/signed.test.xml
253
+ - spec/assets/transformed.xml
251
254
  - spec/assets/unsigned.test.xml
252
255
  - spec/assets/x509.crt
253
256
  - spec/spec_helper.rb
Binary file