def _prepare_auth_attributes_to_digest(auth_attributes_instance):
"""
Prepares autheticated attributes field to digesting process.
Replaces implicit tag with SET tag.
"""
implicit_tag = chr(0xa0) # implicit tag of the set of authAtt
set_tag = chr(0x31) # tag of the ASN type "set"
# encode authentcatdAttributes instance into DER
attrs = encoder.encode(auth_attributes_instance)
# remove implicit tag
if (attrs[0] == implicit_tag):
attrs = attrs.lstrip(implicit_tag)
attrs = str(set_tag) + attrs
return attrs
评论列表
文章目录