summaryrefslogtreecommitdiff
path: root/tools/certtools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/certtools.py')
-rw-r--r--tools/certtools.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index ed8ab30..dfd5b24 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -15,6 +15,7 @@ import ecdsa
import datetime
import cStringIO
import zipfile
+import shutil
from certkeys import publickeys
def get_cert_info(s):
@@ -734,3 +735,11 @@ def extract_original_entry(entry):
leaf_cert = precert
certchain = decode_certificate_chain(extra_data)
return ([leaf_cert] + certchain, timestamp, issuer_key_hash)
+
+def mv_file(fromfn, tofn):
+ shutil.move(fromfn, tofn)
+
+def write_file(fn, sth):
+ tempname = fn + ".new"
+ open(tempname, 'w').write(json.dumps(sth))
+ mv_file(tempname, fn)