Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-jams
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-jams
Commits
4fe1e210
Commit
4fe1e210
authored
4 years ago
by
William Enright
Committed by
Larbi Gharib
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ported and adjusted OCSP endpoint
Change-Id: I892c4e5626d7f38ff8b1c37cdfa9e3755c3f96cb
parent
c2d329d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jams-server/src/main/java/net/jami/jams/server/servlets/x509/OCSPServlet.java
+22
-6
22 additions, 6 deletions
.../java/net/jami/jams/server/servlets/x509/OCSPServlet.java
with
22 additions
and
6 deletions
jams-server/src/main/java/net/jami/jams/server/servlets/x509/OCSPServlet.java
+
22
−
6
View file @
4fe1e210
...
...
@@ -22,22 +22,38 @@
*/
package
net.jami.jams.server.servlets.x509
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.annotation.WebServlet
;
import
jakarta.servlet.http.HttpServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.bouncycastle.cert.ocsp.OCSPReq
;
import
org.bouncycastle.cert.ocsp.OCSPResp
;
import
java.io.IOException
;
import
static
net
.
jami
.
jams
.
server
.
Server
.
certificateAuthority
;
@WebServlet
(
"/api/
auth/
ocsp"
)
@WebServlet
(
"/api/ocsp"
)
public
class
OCSPServlet
extends
HttpServlet
{
@Override
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
certificateAuthority
.
getOCSPResponse
(
null
);
super
.
doGet
(
req
,
resp
);
protected
void
doPost
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
IOException
{
resp
.
setContentType
(
"application/ocsp-response"
);
byte
[]
content
=
new
byte
[
Integer
.
parseInt
(
req
.
getHeader
(
"Content-Length"
))];
try
{
for
(
int
i
=
0
;
i
<
content
.
length
;
i
++){
req
.
getInputStream
().
read
(
content
);
}
OCSPReq
ocspReq
=
new
OCSPReq
(
content
);
OCSPResp
ocspResp
=
certificateAuthority
.
getOCSPResponse
(
ocspReq
);
if
(
ocspResp
!=
null
)
{
byte
[]
respBytes
=
ocspResp
.
getEncoded
();
resp
.
getOutputStream
().
write
(
respBytes
);
}
else
resp
.
setStatus
(
404
);
}
catch
(
Exception
e
)
{
resp
.
sendError
(
404
,
"Could not find the requested certificate!"
);
}
}
}
}
\ No newline at end of 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