R
Randhir Singh
Hello All,
I'm working on a web application that enables users to download
certificates via a link on the website. As we all know, its
impossible to write binary data in JSP, besides using
ServletOutputStream. However, using ServletOutputStream is not
working for me. The binary data (PKI certificate)is held in a LDAP
directory. The following is a snippet of the code that im using to
pull the certificate.
.....
.....
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + cn
+ extension);
ServletOutputStream outputStream = response.getOutputStream();
String value = sr.getAttributes().get(attribute).get(0).toString();
byte [] binValue = value.getBytes();
outputStream.write(binValue);
outputStream.flush();
.....
.....
This code prompts me with a save dialogue and allows me to save the
certificate in a p7b file... and ofcourse it is invalid. When I open
the certificate in a text editor, I see many "?" and other charactors
(some of which are correct, ie CRL distribution point, etc), but the
"?" makes me believe that this is not the binary data. If anyone out
there can point me in the right direction or tell me what im doing
wrong it would be GREATLY appreciated!
Thanks a lot.
I'm working on a web application that enables users to download
certificates via a link on the website. As we all know, its
impossible to write binary data in JSP, besides using
ServletOutputStream. However, using ServletOutputStream is not
working for me. The binary data (PKI certificate)is held in a LDAP
directory. The following is a snippet of the code that im using to
pull the certificate.
.....
.....
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + cn
+ extension);
ServletOutputStream outputStream = response.getOutputStream();
String value = sr.getAttributes().get(attribute).get(0).toString();
byte [] binValue = value.getBytes();
outputStream.write(binValue);
outputStream.flush();
.....
.....
This code prompts me with a save dialogue and allows me to save the
certificate in a p7b file... and ofcourse it is invalid. When I open
the certificate in a text editor, I see many "?" and other charactors
(some of which are correct, ie CRL distribution point, etc), but the
"?" makes me believe that this is not the binary data. If anyone out
there can point me in the right direction or tell me what im doing
wrong it would be GREATLY appreciated!
Thanks a lot.