Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cam
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai
cam
Commits
7e4567f1
Commit
7e4567f1
authored
Aug 17, 2014
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made signature algorithm configurable
parent
09eeaa8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
cam/ca.py
cam/ca.py
+3
-1
cam/tests/test_ca.py
cam/tests/test_ca.py
+15
-0
No files found.
cam/ca.py
View file @
7e4567f1
...
...
@@ -28,7 +28,7 @@ class CA(object):
self
.
basedir
=
basedir
self
.
config
=
{
'basedir'
:
basedir
,
'default_days'
:
'365'
,
'ou'
:
'CA'
,
'days'
:
'3650'
,
'country'
:
'XX'
,
'crl_url'
:
''
,
'
bits'
:
'4096
'
}
'
signature_algorithm'
:
'sha1'
,
'bits'
:
'2048
'
}
self
.
config
.
update
(
config
)
self
.
files
=
_CAFiles
(
basedir
,
conf
=
'conf/ca.conf'
,
...
...
@@ -113,6 +113,7 @@ class CA(object):
self
.
basedir
,
self
.
files
.
conf
,
'ca'
,
'-keyfile'
,
self
.
files
.
private_key
,
'-key'
,
self
.
_getpw
(),
'-md'
,
self
.
config
[
'signature_algorithm'
],
'-extensions'
,
'v3_ca'
,
'-out'
,
self
.
files
.
public_key
,
'-days'
,
self
.
config
.
get
(
'days'
,
self
.
config
[
'default_days'
]),
'-selfsign'
,
'-infiles'
,
csr_file
)
...
...
@@ -192,6 +193,7 @@ class CA(object):
self
.
basedir
,
conf_file
,
'ca'
,
'-days'
,
conf
[
'days'
],
'-key'
,
self
.
_getpw
(),
'-md'
,
self
.
config
[
'signature_algorithm'
],
'-policy'
,
'policy_anything'
,
'-out'
,
cert
.
public_key_file
,
'-extfile'
,
ext_file
,
'-infiles'
,
csr_file
)
finally
:
...
...
cam/tests/test_ca.py
View file @
7e4567f1
...
...
@@ -2,6 +2,7 @@ import logging
import
os
import
tempfile
import
shutil
import
subprocess
import
unittest
from
cam
import
ca
from
cam
import
openssl_wrap
...
...
@@ -24,6 +25,9 @@ class CertStub(object):
def
get_expiration_date
(
self
):
return
123456789
def
exists
(
self
):
return
os
.
path
.
exists
(
self
.
public_key_file
)
class
CATest
(
unittest
.
TestCase
):
...
...
@@ -49,6 +53,17 @@ class CATest(unittest.TestCase):
self
.
assertTrue
(
os
.
path
.
exists
(
cert
.
public_key_file
))
self
.
assertTrue
(
os
.
path
.
exists
(
cert
.
private_key_file
))
def
test_create_cert_with_sha2_signature
(
self
):
self
.
ca
.
config
[
'signature_algorithm'
]
=
'sha256'
self
.
ca
.
create
()
cert
=
CertStub
(
'test'
,
'www.test.com'
,
self
.
tmpdir
)
self
.
ca
.
generate
(
cert
)
self
.
assertTrue
(
os
.
path
.
exists
(
cert
.
public_key_file
))
self
.
assertTrue
(
os
.
path
.
exists
(
cert
.
private_key_file
))
self
.
assertTrue
(
'Signature Algorithm: sha256WithRSAEncryption'
in
subprocess
.
check_output
(
[
'openssl'
,
'x509'
,
'-text'
,
'-noout'
,
'-in'
,
cert
.
public_key_file
]))
def
test_revoke
(
self
):
self
.
ca
.
create
()
cert
=
CertStub
(
'test'
,
'www.test.com'
,
self
.
tmpdir
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment