12
12
ENCODING_BASE64 = 'http://www.w3.org/2000/09/xmldsig#base64'
13
13
14
14
# digest and signature algorithms (not implemented = commented out)
15
- DIGEST_MD5 = 'http://www.w3.org/2001/04/xmldsig-more#md5' # test framework only!
15
+ DIGEST_MD5 = 'http://www.w3.org/2001/04/xmldsig-more#md5' # test framework
16
+ # only!
16
17
DIGEST_SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'
17
18
DIGEST_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#sha224'
18
19
DIGEST_SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
28
29
('DIGEST_RIPEMD160' , DIGEST_RIPEMD160 ))
29
30
DIGEST_AVAIL_ALG = DIGEST_ALLOWED_ALG + (('DIGEST_MD5' , DIGEST_MD5 ),)
30
31
31
- # SIG_DSA_SHA1 = 'http,//www.w3.org/2000/09/xmldsig#dsa-sha1'
32
- # SIG_DSA_SHA256 = 'http://www.w3.org/2009/xmldsig11#dsa-sha256'
33
- # SIG_ECDSA_SHA1 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha1'
34
- # SIG_ECDSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha224'
35
- # SIG_ECDSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha256'
36
- # SIG_ECDSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha384'
37
- # SIG_ECDSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha512'
32
+ SIG_DSA_SHA1 = 'http,//www.w3.org/2000/09/xmldsig#dsa-sha1'
33
+ SIG_DSA_SHA256 = 'http://www.w3.org/2009/xmldsig11#dsa-sha256'
34
+ SIG_ECDSA_SHA1 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha1'
35
+ SIG_ECDSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha224'
36
+ SIG_ECDSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha256'
37
+ SIG_ECDSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha384'
38
+ SIG_ECDSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha512'
38
39
SIG_RSA_MD5 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-md5' # test framework
39
40
SIG_RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
40
41
SIG_RSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha224'
41
42
SIG_RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
42
43
SIG_RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'
43
44
SIG_RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'
44
- # SIG_RSA_RIPEMD160 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160'
45
+ SIG_RSA_RIPEMD160 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160'
45
46
sig_default = SIG_RSA_SHA1
46
47
SIG_ALLOWED_ALG = (('SIG_RSA_SHA1' , SIG_RSA_SHA1 ),
47
48
('SIG_RSA_SHA224' , SIG_RSA_SHA224 ),
@@ -138,7 +139,8 @@ def signature_value_type__from_string(xml_string):
138
139
139
140
140
141
class CanonicalizationMethodType_ (SamlBase ):
141
- """The http://www.w3.org/2000/09/xmldsig#:CanonicalizationMethodType element """
142
+ """The http://www.w3.org/2000/09/xmldsig#:CanonicalizationMethodType
143
+ element """
142
144
143
145
c_tag = 'CanonicalizationMethodType'
144
146
c_namespace = NAMESPACE
@@ -190,8 +192,8 @@ class TransformType_(SamlBase):
190
192
c_attributes = SamlBase .c_attributes .copy ()
191
193
c_child_order = SamlBase .c_child_order [:]
192
194
c_cardinality = SamlBase .c_cardinality .copy ()
193
- c_children ['{http://www.w3.org/2000/09/xmldsig#}XPath' ] = ('x_path' ,
194
- [TransformType_XPath ])
195
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}XPath' ] = (
196
+ 'x_path' , [TransformType_XPath ])
195
197
c_cardinality ['x_path' ] = {"min" : 0 }
196
198
c_attributes ['Algorithm' ] = ('algorithm' , 'anyURI' , True )
197
199
c_child_order .extend (['x_path' ])
@@ -331,9 +333,9 @@ class X509IssuerSerialType_(SamlBase):
331
333
c_child_order = SamlBase .c_child_order [:]
332
334
c_cardinality = SamlBase .c_cardinality .copy ()
333
335
c_children ['{http://www.w3.org/2000/09/xmldsig#}X509IssuerName' ] = (
334
- 'x509_issuer_name' , X509IssuerName )
336
+ 'x509_issuer_name' , X509IssuerName )
335
337
c_children ['{http://www.w3.org/2000/09/xmldsig#}X509SerialNumber' ] = (
336
- 'x509_serial_number' , X509SerialNumber )
338
+ 'x509_serial_number' , X509SerialNumber )
337
339
c_child_order .extend (['x509_issuer_name' , 'x509_serial_number' ])
338
340
339
341
def __init__ (self ,
@@ -393,9 +395,10 @@ class PGPDataType_(SamlBase):
393
395
c_attributes = SamlBase .c_attributes .copy ()
394
396
c_child_order = SamlBase .c_child_order [:]
395
397
c_cardinality = SamlBase .c_cardinality .copy ()
396
- c_children ['{http://www.w3.org/2000/09/xmldsig#}PGPKeyID' ] = ('pgp_key_id' , PGPKeyID )
398
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}PGPKeyID' ] = (
399
+ 'pgp_key_id' , PGPKeyID )
397
400
c_children ['{http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket' ] = (
398
- 'pgp_key_packet' , PGPKeyPacket )
401
+ 'pgp_key_packet' , PGPKeyPacket )
399
402
c_cardinality ['pgp_key_packet' ] = {"min" : 0 , "max" : 1 }
400
403
c_child_order .extend (['pgp_key_id' , 'pgp_key_packet' ])
401
404
@@ -529,7 +532,8 @@ def __init__(self,
529
532
530
533
531
534
def signature_property_type__from_string (xml_string ):
532
- return saml2 .create_class_from_xml_string (SignaturePropertyType_ , xml_string )
535
+ return saml2 .create_class_from_xml_string (SignaturePropertyType_ ,
536
+ xml_string )
533
537
534
538
535
539
class HMACOutputLengthType_ (SamlBase ):
@@ -659,8 +663,8 @@ class DSAKeyValueType_(SamlBase):
659
663
c_cardinality ['j' ] = {"min" : 0 , "max" : 1 }
660
664
c_children ['{http://www.w3.org/2000/09/xmldsig#}Seed' ] = ('seed' , Seed )
661
665
c_cardinality ['seed' ] = {"min" : 0 , "max" : 1 }
662
- c_children ['{http://www.w3.org/2000/09/xmldsig#}PgenCounter' ] = ('pgen_counter' ,
663
- PgenCounter )
666
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}PgenCounter' ] = (
667
+ 'pgen_counter' , PgenCounter )
664
668
c_cardinality ['pgen_counter' ] = {"min" : 0 , "max" : 1 }
665
669
c_child_order .extend (['p' , 'q' , 'g' , 'y' , 'j' , 'seed' , 'pgen_counter' ])
666
670
@@ -809,7 +813,7 @@ class SignatureMethodType_(SamlBase):
809
813
c_child_order = SamlBase .c_child_order [:]
810
814
c_cardinality = SamlBase .c_cardinality .copy ()
811
815
c_children ['{http://www.w3.org/2000/09/xmldsig#}HMACOutputLength' ] = (
812
- 'hmac_output_length' , HMACOutputLength )
816
+ 'hmac_output_length' , HMACOutputLength )
813
817
c_cardinality ['hmac_output_length' ] = {"min" : 0 , "max" : 1 }
814
818
c_attributes ['Algorithm' ] = ('algorithm' , 'anyURI' , True )
815
819
c_child_order .extend (['hmac_output_length' ])
@@ -957,17 +961,20 @@ class X509DataType_(SamlBase):
957
961
c_attributes = SamlBase .c_attributes .copy ()
958
962
c_child_order = SamlBase .c_child_order [:]
959
963
c_cardinality = SamlBase .c_cardinality .copy ()
960
- c_children ['{http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial' ] = ('x509_issuer_serial' ,
961
- X509IssuerSerial )
964
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial' ] = (
965
+ 'x509_issuer_serial' ,
966
+ X509IssuerSerial )
962
967
c_cardinality ['x509_issuer_serial' ] = {"min" : 0 , "max" : 1 }
963
968
c_children ['{http://www.w3.org/2000/09/xmldsig#}X509SKI' ] = ('x509_ski' ,
964
969
X509SKI )
965
970
c_cardinality ['x509_ski' ] = {"min" : 0 , "max" : 1 }
966
- c_children ['{http://www.w3.org/2000/09/xmldsig#}X509SubjectName' ] = ('x509_subject_name' ,
967
- X509SubjectName )
971
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}X509SubjectName' ] = (
972
+ 'x509_subject_name' ,
973
+ X509SubjectName )
968
974
c_cardinality ['x509_subject_name' ] = {"min" : 0 , "max" : 1 }
969
- c_children ['{http://www.w3.org/2000/09/xmldsig#}X509Certificate' ] = ('x509_certificate' ,
970
- X509Certificate )
975
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}X509Certificate' ] = (
976
+ 'x509_certificate' ,
977
+ X509Certificate )
971
978
c_cardinality ['x509_certificate' ] = {"min" : 0 , "max" : 1 }
972
979
c_children ['{http://www.w3.org/2000/09/xmldsig#}X509CRL' ] = ('x509_crl' ,
973
980
X509CRL )
@@ -1147,11 +1154,11 @@ class KeyValueType_(SamlBase):
1147
1154
c_attributes = SamlBase .c_attributes .copy ()
1148
1155
c_child_order = SamlBase .c_child_order [:]
1149
1156
c_cardinality = SamlBase .c_cardinality .copy ()
1150
- c_children ['{http://www.w3.org/2000/09/xmldsig#}DSAKeyValue' ] = ('dsa_key_value' ,
1151
- DSAKeyValue )
1157
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}DSAKeyValue' ] = (
1158
+ 'dsa_key_value' , DSAKeyValue )
1152
1159
c_cardinality ['dsa_key_value' ] = {"min" : 0 , "max" : 1 }
1153
- c_children ['{http://www.w3.org/2000/09/xmldsig#}RSAKeyValue' ] = ('rsa_key_value' ,
1154
- RSAKeyValue )
1160
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}RSAKeyValue' ] = (
1161
+ 'rsa_key_value' , RSAKeyValue )
1155
1162
c_cardinality ['rsa_key_value' ] = {"min" : 0 , "max" : 1 }
1156
1163
c_child_order .extend (['dsa_key_value' , 'rsa_key_value' ])
1157
1164
@@ -1191,7 +1198,8 @@ def x509_data_from_string(xml_string):
1191
1198
1192
1199
1193
1200
class SignaturePropertiesType_ (SamlBase ):
1194
- """The http://www.w3.org/2000/09/xmldsig#:SignaturePropertiesType element """
1201
+ """The http://www.w3.org/2000/09/xmldsig#:SignaturePropertiesType element
1202
+ """
1195
1203
1196
1204
c_tag = 'SignaturePropertiesType'
1197
1205
c_namespace = NAMESPACE
@@ -1200,7 +1208,7 @@ class SignaturePropertiesType_(SamlBase):
1200
1208
c_child_order = SamlBase .c_child_order [:]
1201
1209
c_cardinality = SamlBase .c_cardinality .copy ()
1202
1210
c_children ['{http://www.w3.org/2000/09/xmldsig#}SignatureProperty' ] = (
1203
- 'signature_property' , [SignatureProperty ])
1211
+ 'signature_property' , [SignatureProperty ])
1204
1212
c_cardinality ['signature_property' ] = {"min" : 1 }
1205
1213
c_attributes ['Id' ] = ('id' , 'ID' , False )
1206
1214
c_child_order .extend (['signature_property' ])
@@ -1222,7 +1230,8 @@ def __init__(self,
1222
1230
1223
1231
1224
1232
def signature_properties_type__from_string (xml_string ):
1225
- return saml2 .create_class_from_xml_string (SignaturePropertiesType_ , xml_string )
1233
+ return saml2 .create_class_from_xml_string (SignaturePropertiesType_ ,
1234
+ xml_string )
1226
1235
1227
1236
1228
1237
class Transforms (TransformsType_ ):
@@ -1264,8 +1273,8 @@ class RetrievalMethodType_(SamlBase):
1264
1273
c_attributes = SamlBase .c_attributes .copy ()
1265
1274
c_child_order = SamlBase .c_child_order [:]
1266
1275
c_cardinality = SamlBase .c_cardinality .copy ()
1267
- c_children ['{http://www.w3.org/2000/09/xmldsig#}Transforms' ] = ('transforms' ,
1268
- Transforms )
1276
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}Transforms' ] = (
1277
+ 'transforms' , Transforms )
1269
1278
c_cardinality ['transforms' ] = {"min" : 0 , "max" : 1 }
1270
1279
c_attributes ['URI' ] = ('uri' , 'anyURI' , False )
1271
1280
c_attributes ['Type' ] = ('type' , 'anyURI' , False )
@@ -1317,13 +1326,13 @@ class ReferenceType_(SamlBase):
1317
1326
c_attributes = SamlBase .c_attributes .copy ()
1318
1327
c_child_order = SamlBase .c_child_order [:]
1319
1328
c_cardinality = SamlBase .c_cardinality .copy ()
1320
- c_children ['{http://www.w3.org/2000/09/xmldsig#}Transforms' ] = ('transforms' ,
1321
- Transforms )
1329
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}Transforms' ] = (
1330
+ 'transforms' , Transforms )
1322
1331
c_cardinality ['transforms' ] = {"min" : 0 , "max" : 1 }
1323
- c_children ['{http://www.w3.org/2000/09/xmldsig#}DigestMethod' ] = ('digest_method' ,
1324
- DigestMethod )
1325
- c_children ['{http://www.w3.org/2000/09/xmldsig#}DigestValue' ] = ('digest_value' ,
1326
- DigestValue )
1332
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}DigestMethod' ] = (
1333
+ 'digest_method' , DigestMethod )
1334
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}DigestValue' ] = (
1335
+ 'digest_value' , DigestValue )
1327
1336
c_attributes ['Id' ] = ('id' , 'ID' , False )
1328
1337
c_attributes ['URI' ] = ('uri' , 'anyURI' , False )
1329
1338
c_attributes ['Type' ] = ('type' , 'anyURI' , False )
@@ -1507,9 +1516,9 @@ class SignedInfoType_(SamlBase):
1507
1516
c_child_order = SamlBase .c_child_order [:]
1508
1517
c_cardinality = SamlBase .c_cardinality .copy ()
1509
1518
c_children ['{http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod' ] = (
1510
- 'canonicalization_method' , CanonicalizationMethod )
1511
- c_children ['{http://www.w3.org/2000/09/xmldsig#}SignatureMethod' ] = ('signature_method' ,
1512
- SignatureMethod )
1519
+ 'canonicalization_method' , CanonicalizationMethod )
1520
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}SignatureMethod' ] = (
1521
+ 'signature_method' , SignatureMethod )
1513
1522
c_children ['{http://www.w3.org/2000/09/xmldsig#}Reference' ] = ('reference' ,
1514
1523
[Reference ])
1515
1524
c_cardinality ['reference' ] = {"min" : 1 }
@@ -1595,10 +1604,10 @@ class SignatureType_(SamlBase):
1595
1604
c_attributes = SamlBase .c_attributes .copy ()
1596
1605
c_child_order = SamlBase .c_child_order [:]
1597
1606
c_cardinality = SamlBase .c_cardinality .copy ()
1598
- c_children ['{http://www.w3.org/2000/09/xmldsig#}SignedInfo' ] = ('signed_info' ,
1599
- SignedInfo )
1607
+ c_children ['{http://www.w3.org/2000/09/xmldsig#}SignedInfo' ] = (
1608
+ 'signed_info' , SignedInfo )
1600
1609
c_children ['{http://www.w3.org/2000/09/xmldsig#}SignatureValue' ] = (
1601
- 'signature_value' , SignatureValue )
1610
+ 'signature_value' , SignatureValue )
1602
1611
c_children ['{http://www.w3.org/2000/09/xmldsig#}KeyInfo' ] = ('key_info' ,
1603
1612
KeyInfo )
1604
1613
c_cardinality ['key_info' ] = {"min" : 0 , "max" : 1 }
@@ -1659,7 +1668,8 @@ def signature_from_string(xml_string):
1659
1668
SignedInfo .c_tag : signed_info_from_string ,
1660
1669
SignedInfoType_ .c_tag : signed_info_type__from_string ,
1661
1670
CanonicalizationMethod .c_tag : canonicalization_method_from_string ,
1662
- CanonicalizationMethodType_ .c_tag : canonicalization_method_type__from_string ,
1671
+ CanonicalizationMethodType_ .c_tag :
1672
+ canonicalization_method_type__from_string ,
1663
1673
SignatureMethod .c_tag : signature_method_from_string ,
1664
1674
SignatureMethodType_ .c_tag : signature_method_type__from_string ,
1665
1675
Reference .c_tag : reference_from_string ,
0 commit comments