aboutsummaryrefslogtreecommitdiff
path: root/pow
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-11-18 13:42:07 +0000
committerRob Austein <sra@hactrn.net>2009-11-18 13:42:07 +0000
commit32659a7d842bb447bfd8d0da7f3c58657f34248c (patch)
tree788c912142d729f583689844a73c092b2e015d63 /pow
parent0b8d580734cd0dcc2ec2c7022ba0e4b8d86055d2 (diff)
Quietly ignore any unknown POW digest algorithms, on the assumption
that they were disabled when POW was compiled (eg, MD2). svn path=/pow/POW-0.7/lib/pkix.py; revision=2885
Diffstat (limited to 'pow')
-rwxr-xr-xpow/POW-0.7/lib/pkix.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/pow/POW-0.7/lib/pkix.py b/pow/POW-0.7/lib/pkix.py
index fc525cad..2d5b3e86 100755
--- a/pow/POW-0.7/lib/pkix.py
+++ b/pow/POW-0.7/lib/pkix.py
@@ -99,16 +99,20 @@ class POWCryptoDriver(CryptoDriver):
def __init__(self):
global POW
import POW
- self.driver2OID = {
-# POW.MD2_DIGEST : (1, 2, 840, 113549, 1, 1, 2), # md2WithRSAEncryption
- POW.MD5_DIGEST : (1, 2, 840, 113549, 1, 1, 4), # md5WithRSAEncryption
- POW.SHA_DIGEST : (1, 3, 14, 3, 2, 15), # shaWithRSAEncryption
- POW.SHA1_DIGEST : (1, 2, 840, 113549, 1, 1, 5), # sha1withRSAEncryption
- POW.RIPEMD160_DIGEST : (1, 2, 840, 113549, 1, 1, 6), # ripemd160WithRSAEncryption
- POW.SHA256_DIGEST : (1, 2, 840, 113549, 1, 1, 11), # sha256WithRSAEncryption
- POW.SHA384_DIGEST : (1, 2, 840, 113549, 1, 1, 12), # sha384WithRSAEncryption
- POW.SHA512_DIGEST : (1, 2, 840, 113549, 1, 1, 13), # sha512WithRSAEncryption
- }
+ self.driver2OID = {}
+ for k, v in (("MD2_DIGEST", (1, 2, 840, 113549, 1, 1, 2)), # md2WithRSAEncryption
+ ("MD5_DIGEST", (1, 2, 840, 113549, 1, 1, 4)), # md5WithRSAEncryption
+ ("SHA_DIGEST", (1, 3, 14, 3, 2, 15)), # shaWithRSAEncryption
+ ("SHA1_DIGEST", (1, 2, 840, 113549, 1, 1, 5)), # sha1withRSAEncryption
+ ("RIPEMD160_DIGEST", (1, 2, 840, 113549, 1, 1, 6)), # ripemd160WithRSAEncryption
+ ("SHA256_DIGEST", (1, 2, 840, 113549, 1, 1, 11)), # sha256WithRSAEncryption
+ ("SHA384_DIGEST", (1, 2, 840, 113549, 1, 1, 12)), # sha384WithRSAEncryption
+ ("SHA512_DIGEST", (1, 2, 840, 113549, 1, 1, 13)), # sha512WithRSAEncryption
+ ):
+ try:
+ self.driver2OID[getattr(POW, k)] = v
+ except AttributeError:
+ pass
self.OID2driver = dict((v,k) for k,v in self.driver2OID.items())
def _digest(self, oid, plaintext):