Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
5dc3d3cf
Commit
5dc3d3cf
authored
10 months ago
by
Amna Snene
Committed by
Adrien Béraud
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Raise an error if any Identity file fails to save
parent
5397f80b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crypto.cpp
+6
-0
6 additions, 0 deletions
src/crypto.cpp
with
6 additions
and
0 deletions
src/crypto.cpp
+
6
−
0
View file @
5dc3d3cf
...
...
@@ -1164,11 +1164,17 @@ saveIdentity(const Identity& id, const std::string& path, const std::string& pri
auto
ca_key_data
=
id
.
first
->
serialize
(
privkey_password
);
std
::
ofstream
key_file
(
path
+
".pem"
);
key_file
.
write
((
char
*
)
ca_key_data
.
data
(),
ca_key_data
.
size
());
// Throw error if the file is not written
if
(
!
key_file
)
throw
CryptoException
(
"Could not write private key file"
);
}
{
auto
ca_key_data
=
id
.
second
->
getPacked
();
std
::
ofstream
crt_file
(
path
+
".crt"
);
crt_file
.
write
((
char
*
)
ca_key_data
.
data
(),
ca_key_data
.
size
());
// Throw error if the file is not written
if
(
!
crt_file
)
throw
CryptoException
(
"Could not write certificate file"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment