Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
cb0220d3
Commit
cb0220d3
authored
Oct 31, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_certificate_authority: Implement ir properly with serialisation
parent
db57a4da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
9 deletions
+55
-9
bt5/erp5_certificate_authority/DocumentTemplateItem/portal_components/document.erp5.CaucaseConnector.py
...eItem/portal_components/document.erp5.CaucaseConnector.py
+17
-9
bt5/erp5_certificate_authority/PropertySheetTemplateItem/portal_property_sheets/CaucaseConnector/private_template_key_property.xml
...sheets/CaucaseConnector/private_template_key_property.xml
+38
-0
No files found.
bt5/erp5_certificate_authority/DocumentTemplateItem/portal_components/document.erp5.CaucaseConnector.py
View file @
cb0220d3
...
...
@@ -48,8 +48,6 @@ _DEFAULTBACKEND = default_backend()
class
CaucaseConnector
(
XMLObject
):
meta_type
=
'Caucase Connector'
__private_template_key
=
None
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
...
...
@@ -80,14 +78,24 @@ class CaucaseConnector(XMLObject):
user_key_file
.
flush
()
return
self
.
_getServiceConnection
(
user_key
=
user_key_file
.
name
)
def
__getPrivateTemplateKey
(
self
):
if
not
self
.
__private_template_key
:
self
.
__private_template_key
=
rsa
.
generate_private_key
(
public_exponent
=
65537
,
key_size
=
2048
,
backend
=
_DEFAULTBACKEND
)
return
self
.
__private_template_key
def
getCertificateSigningRequestTemplate
(
self
,
common_name
):
key
=
self
.
__getPrivateTemplateKey
()
key_pem
=
self
.
getPrivateTemplateKey
()
if
not
key_pem
:
key
=
rsa
.
generate_private_key
(
public_exponent
=
65537
,
key_size
=
2048
,
backend
=
_DEFAULTBACKEND
)
self
.
setPrivateTemplateKey
(
key
.
private_bytes
(
encoding
=
serialization
.
Encoding
.
PEM
,
format
=
serialization
.
PrivateFormat
.
PKCS8
,
encryption_algorithm
=
serialization
.
NoEncryption
()).
decode
())
else
:
key
=
serialization
.
load_pem_private_key
(
key_pem
,
password
=
None
,
backend
=
_DEFAULTBACKEND
)
name_attribute_list
=
self
.
_getSubjectNameAttributeList
()
name_attribute_list
.
append
(
...
...
bt5/erp5_certificate_authority/PropertySheetTemplateItem/portal_property_sheets/CaucaseConnector/private_template_key_property.xml
0 → 100644
View file @
cb0220d3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/text
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
private_template_key_property
</string>
</value>
</item>
<item>
<key>
<string>
read_permission
</string>
</key>
<value>
<string>
Manage users
</string>
</value>
</item>
<item>
<key>
<string>
write_permission
</string>
</key>
<value>
<string>
Manage users
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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