v.licheni.net
/
stack
/
cam.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ff933c3
)
ensure that the generated CRL is in DER format
author
ale
<ale@incal.net>
Mon, 10 Dec 2012 19:51:32 +0000
(19:51 +0000)
committer
ale
<ale@incal.net>
Mon, 10 Dec 2012 19:51:32 +0000
(19:51 +0000)
cam/ca.py
patch
|
blob
|
history
cam/tests/test_ca.py
patch
|
blob
|
history
diff --git
a/cam/ca.py
b/cam/ca.py
index
84e9b4c
..
72ae773
100644
(file)
--- a/
cam/ca.py
+++ b/
cam/ca.py
@@
-34,7
+34,7
@@
class CA(object):
conf='conf/ca.conf',
public_key='public/ca.pem',
private_key='private/ca.key',
conf='conf/ca.conf',
public_key='public/ca.pem',
private_key='private/ca.key',
- crl='public/c
rl.pem
',
+ crl='public/c
a.crl
',
serial='serial',
crlnumber='crlnumber',
index='index')
serial='serial',
crlnumber='crlnumber',
index='index')
@@
-128,10
+128,17
@@
class CA(object):
def gencrl(self):
log.info('generating CRL')
def gencrl(self):
log.info('generating CRL')
+ # Write the CRL in PEM format to a temporary file.
+ tmpf = self.files.crl + '.tmp'
openssl_wrap.run_with_config(
self.basedir, self.files.conf,
openssl_wrap.run_with_config(
self.basedir, self.files.conf,
- 'ca', '-gencrl', '-out',
self.files.crl
,
+ 'ca', '-gencrl', '-out',
tmpf
,
'-key', self._getpw())
'-key', self._getpw())
+ # Convert to DER format for distribution.
+ openssl_wrap.run(
+ 'crl', '-inform', 'PEM', '-outform', 'DER',
+ '-in', tmpf, '-out', self.files.crl)
+ os.remove(tmpf)
os.chmod(self.files.crl, 0644)
def revoke(self, cert):
os.chmod(self.files.crl, 0644)
def revoke(self, cert):
diff --git
a/cam/tests/test_ca.py
b/cam/tests/test_ca.py
index
c443fe4
..
35c61a3
100644
(file)
--- a/
cam/tests/test_ca.py
+++ b/
cam/tests/test_ca.py
@@
-54,4
+54,4
@@
class CATest(unittest.TestCase):
cert = CertStub('test', 'www.test.com', self.tmpdir)
self.ca.generate(cert)
self.ca.revoke(cert)
cert = CertStub('test', 'www.test.com', self.tmpdir)
self.ca.generate(cert)
self.ca.revoke(cert)
- self.assertTrue(os.path.exists(os.path.join(self.tmpdir, 'public/c
rl.pem
')))
+ self.assertTrue(os.path.exists(os.path.join(self.tmpdir, 'public/c
a.crl
')))