summaryrefslogtreecommitdiff
path: root/tools/certtools.py
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2015-08-19 16:23:50 +0200
committerLinus Nordberg <linus@nordu.net>2015-08-19 16:23:50 +0200
commit3464a089a9ccbac1a8bc92c8dfba402e7e307733 (patch)
tree071448a641b3fb5fffcd2bcb38c1a3e2b52ad7ae /tools/certtools.py
parent83472c419a90deb33d21d2e69632e421f094318f (diff)
parentfae6b9c78099fa40bcbf9ed451979cdca715fef0 (diff)
Merge remote-tracking branch 'refs/remotes/map/storagegc'
Conflicts: Makefile
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)