@@ -391,6 +391,45 @@ def __eq__(self, other):
391
391
392
392
return True
393
393
394
+ def certs (self , entity_id , descriptor , use = "signing" ):
395
+ ent = self .__getitem__ (entity_id )
396
+ if descriptor == "any" :
397
+ res = []
398
+ for descr in ["spsso" , "idpsso" , "role" , "authn_authority" ,
399
+ "attribute_authority" , "pdp" ]:
400
+ try :
401
+ srvs = ent ["%s_descriptor" % descr ]
402
+ except KeyError :
403
+ continue
404
+
405
+ for srv in srvs :
406
+ for key in srv ["key_descriptor" ]:
407
+ if "use" in key and key ["use" ] == use :
408
+ for dat in key ["key_info" ]["x509_data" ]:
409
+ cert = repack_cert (
410
+ dat ["x509_certificate" ]["text" ])
411
+ if cert not in res :
412
+ res .append (cert )
413
+ elif not "use" in key :
414
+ for dat in key ["key_info" ]["x509_data" ]:
415
+ cert = repack_cert (
416
+ dat ["x509_certificate" ]["text" ])
417
+ if cert not in res :
418
+ res .append (cert )
419
+ else :
420
+ srvs = ent ["%s_descriptor" % descriptor ]
421
+
422
+ res = []
423
+ for srv in srvs :
424
+ for key in srv ["key_descriptor" ]:
425
+ if "use" in key and key ["use" ] == use :
426
+ for dat in key ["key_info" ]["x509_data" ]:
427
+ res .append (dat ["x509_certificate" ]["text" ])
428
+ elif not "use" in key :
429
+ for dat in key ["key_info" ]["x509_data" ]:
430
+ res .append (dat ["x509_certificate" ]["text" ])
431
+ return res
432
+
394
433
395
434
class MetaDataFile (MetaData ):
396
435
"""
@@ -557,6 +596,7 @@ def __getitem__(self, item):
557
596
md .EntitiesDescriptor .c_tag )
558
597
559
598
_txt = response .text .encode ("utf-8" )
599
+
560
600
if self .cert :
561
601
if self .security .verify_signature (_txt ,
562
602
node_name = node_name ,
@@ -571,6 +611,7 @@ def __getitem__(self, item):
571
611
raise KeyError
572
612
573
613
614
+
574
615
class MetadataStore (object ):
575
616
def __init__ (self , onts , attrc , config , ca_certs = None ,
576
617
check_validity = True ,
0 commit comments