Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
7fac593e
Commit
7fac593e
authored
Dec 17, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1011: Trim each line of a PEM representation
parent
a9815e8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
CertificateManager.java
src/java/org/jivesoftware/util/CertificateManager.java
+6
-2
No files found.
src/java/org/jivesoftware/util/CertificateManager.java
View file @
7fac593e
...
...
@@ -705,8 +705,12 @@ public class CertificateManager {
throw
new
IllegalArgumentException
(
"Argument 'pemRepresentation' cannot be null or an empty String."
);
}
final
Collection
<
X509Certificate
>
certificates
;
try
(
InputStream
inputStream
=
new
ByteArrayInputStream
(
pemRepresentation
.
trim
().
getBytes
()
)
)
// The parser is very picky. We should trim each line of the input string.
final
String
pem
=
pemRepresentation
.
replaceAll
(
"(?m) +$"
,
""
)
// remove trailing whitespace
.
replaceAll
(
"(?m)^ +"
,
""
);
// remove leading whitespace
try
(
InputStream
inputStream
=
new
ByteArrayInputStream
(
pem
.
getBytes
()
)
)
{
final
CertificateFactory
certificateFactory
=
CertificateFactory
.
getInstance
(
"X509"
);
return
(
Collection
<
X509Certificate
>)
certificateFactory
.
generateCertificates
(
inputStream
);
...
...
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