projects
/
certmaster.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make the sha import use hashlib and make the hashlib import work sanely
[certmaster.git]
/
certmaster
/
certmaster.py
diff --git
a/certmaster/certmaster.py
b/certmaster/certmaster.py
index
9548b8b
..
b0a216b
100644
(file)
--- a/
certmaster/certmaster.py
+++ b/
certmaster/certmaster.py
@@
-22,7
+22,19
@@
import traceback
import os
import os.path
from OpenSSL import crypto
import os
import os.path
from OpenSSL import crypto
-import sha
+
+try:
+ import hashlib
+except ImportError:
+ # Python-2.4.z ... gah! (or even 2.3!)
+ import sha
+ class hashlib:
+ @staticmethod
+ def new(algo):
+ if algo == 'sha1':
+ return sha.new()
+ raise ValueError, "Bad checksum type"
+
import glob
import socket
import exceptions
import glob
import socket
import exceptions
@@
-123,10
+135,10
@@
class CertMaster(object):
if os.path.exists(csrfile):
oldfo = open(csrfile)
oldcsrbuf = oldfo.read()
if os.path.exists(csrfile):
oldfo = open(csrfile)
oldcsrbuf = oldfo.read()
- oldsha =
sha.new(
)
+ oldsha =
hashlib.new('sha1'
)
oldsha.update(oldcsrbuf)
olddig = oldsha.hexdigest()
oldsha.update(oldcsrbuf)
olddig = oldsha.hexdigest()
- newsha =
sha.new(
)
+ newsha =
hashlib.new('sha1'
)
newsha.update(csrbuf)
newdig = newsha.hexdigest()
if not newdig == olddig:
newsha.update(csrbuf)
newdig = newsha.hexdigest()
if not newdig == olddig: