/usr/share/web2ldap/pylib/mspki/asn1helper.py is in web2ldap 1.1.43~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | """
asn1helper.py - some utilities to make life easier with asn1.py
(c) by Michael Stroeder <michael@stroeder.com>
This module is distributed under the terms of the
GPL (GNU GENERAL PUBLIC LICENSE) Version 2
(see http://www.gnu.org/copyleft/gpl.html)
This module requires at least sub-module asn1.py of package Pisces
found on http://www.cnri.reston.va.us/software/pisces/
"""
import os, string
from pisces import asn1
oids = {}
def ParseCfg(dumpasn1cfg):
"""
Read descriptions of OIDs either from
Peter Gutmann's dumpasn1.cfg or a pickled copy.
"""
f=open(dumpasn1cfg,'r')
oids=asn1.parseCfg(f)
f.close()
return oids
def GetOIDDescription(oid,oids,includeoid=0):
"""
returns description of oid if present in oids or stringed oid else
"""
try:
cfg_entry = oids[oid]
except KeyError:
return str(oid)
else:
descr = cfg_entry['Description']
if includeoid:
descr = '%s (%s)' % (descr,repr(oid))
return descr
|