OID to cleartext

git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@237 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-06-09 12:10:27 +00:00
parent 38bc6d9efc
commit fd7bcf04a1
2 changed files with 51 additions and 1 deletions

View File

@ -145,9 +145,34 @@ def parse_oid(value):
return tuple(result)
oidCache = {}
def loadOids(filename="oids.txt"):
try:
fp = file(filename, "r")
except (SystemExit,KeyboardInterrupt):
raise
except:
pass
else:
try:
lines = fp.readlines()
finally:
fp.close()
for line in lines:
if line.strip() == "" or line[0] == "#":
continue
parts = line.strip().split(None,2)
if len(parts) < 3:
parts.append(parts[1])
oidCache[parts[0]] = tuple(parts[1:])
def decode_oid(value):
oid = parse_oid(value)
return " " + ".".join([str(a) for a in oid])
str_rep = ".".join([str(a) for a in oid])
if len(oidCache) == 0:
loadOids()
return " %s (%s)" % (str_rep, oidCache.get(str_rep, ("No description available",))[0])
_gtimere = sre.compile(r'(\d{4})(\d\d)(\d\d)(\d\d)(?:(\d\d)(\d\d(?:[.,]\d+)?)?)?(|Z|(?:[+-]\d\d(?:\d\d)?))$')
def decode_generalized_time(value):
@ -484,3 +509,5 @@ if __name__ == "__main__":
c = pack(b, recalculate_length = True)
print utils.hexdump(a)
print utils.hexdump(c)
loadOids()

23
oids.txt Normal file
View File

@ -0,0 +1,23 @@
# From openssl
1.2.840.10045.1.1 prime-field
1.2.840.10045.2.1 id-ecPublicKey
1.2.840.10045.4.1 ecdsa-with-SHA1
1.2.840.113549.1.1.1 rsaEncryption
1.2.840.113549.1.7.2 pkcs7-signedData
1.2.840.113549.1.9.21 localKeyID
1.2.840.113549.1.9.3 contentType
1.2.840.113549.1.9.4 messageDigest
1.3.14.3.2.26 sha1
1.3.36.3.3.1.2 ripemd160WithRSA
2.5.29.15 keyUsage X509v3 Key Usage
2.5.29.16 privateKeyUsagePeriod X509v3 Private Key Usage Period
2.5.29.32 certificatePolicies X509v3 Certificate Policies
2.5.29.35 authorityKeyIdentifier X509v3 Authority Key Identifier
2.5.4.10 organizationName
2.5.4.11 organizationalUnitName
2.5.4.3 commonName
2.5.4.5 serialNumber
2.5.4.6 countryName
# I made this one up --Henryk
2.23.136.1.1.1 icao-sodData The data contained in the EF.SOD