summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2016-05-17 21:34:08 +0200
committerJan Dittberner <jandd@cacert.org>2016-05-17 21:34:08 +0200
commitf9c316193a40bb13d3fe4bf28cdd81cf11cf0fdf (patch)
tree326f64dfaf16dc5585524cd1f708749fb299a14a /tools
parentc544e4a07da86201b31623a6edec6662dfd1a1ff (diff)
downloadcacert-infradocs-f9c316193a40bb13d3fe4bf28cdd81cf11cf0fdf.tar.gz
cacert-infradocs-f9c316193a40bb13d3fe4bf28cdd81cf11cf0fdf.tar.xz
cacert-infradocs-f9c316193a40bb13d3fe4bf28cdd81cf11cf0fdf.zip
Improve sslcert.py tool
- remove invalid pkg-resources dependency - add a --root parameter and relative root calculation to allow certificates and keys in chroots - fix date format for output
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sslcert.py12
-rw-r--r--tools/tool-requirements.txt1
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/sslcert.py b/tools/sslcert.py
index dbdd49f..531a5b5 100755
--- a/tools/sslcert.py
+++ b/tools/sslcert.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
from __future__ import print_function
@@ -47,7 +47,7 @@ def get_serial(cert):
def get_expiration(cert):
return datetime.strptime(
cert.tbsCertificate.validity.valid_to, '%Y%m%d%H%M%SZ'
- ).strftime('%b %d %Y %H:%M:%S GMT')
+ ).strftime('%b %d %H:%M:%S %y GMT')
def get_sha1fp(certdata):
@@ -75,14 +75,22 @@ if __name__ == '__main__':
parser.add_argument(
'--key', metavar='KEY', type=open,
help='PEM encoded RSA private key', default=None)
+ parser.add_argument(
+ '--root', metavar='ROOT', type=str,
+ help='Relative root directory for key and cert')
+
args = parser.parse_args()
certpem = pem.readPemFromFile(args.cert)
certpath = os.path.abspath(args.cert.name)
+ if args.root:
+ certpath = '/' + os.path.relpath(certpath, args.root)
if args.key:
haskey = True
keypem = pem.readPemFromFile(args.key)
keypath = os.path.abspath(args.key.name)
+ if args.root:
+ keypath = '/' + os.path.relpath(keypath, args.root)
else:
keypath = 'TODO: define key path'
diff --git a/tools/tool-requirements.txt b/tools/tool-requirements.txt
index dea6235..e00844f 100644
--- a/tools/tool-requirements.txt
+++ b/tools/tool-requirements.txt
@@ -1,4 +1,3 @@
-pkg-resources==0.0.0
pyasn1==0.1.9
pyasn1-modules==0.0.8
git+https://github.com/hiviah/pyx509@a35702c3d514c96d75a1c3498307a16991cdd0d3#egg=pyx509