File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/main/java/eu/webeid/security/validator/ocsp Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 4848import org .bouncycastle .cert .ocsp .OCSPReq ;
4949import org .bouncycastle .cert .ocsp .OCSPReqBuilder ;
5050
51+ import java .io .IOException ;
5152import java .security .SecureRandom ;
5253import java .util .Objects ;
5354
@@ -82,19 +83,23 @@ public OCSPReq build() throws OCSPException {
8283 builder .addRequest (Objects .requireNonNull (certificateId , "certificateId" ));
8384
8485 if (ocspNonceEnabled ) {
85- addNonce (builder );
86+ try {
87+ addNonce (builder );
88+ } catch (IOException e ) {
89+ throw new OCSPException ("Failed to generate OCSP NONCE extension" , e );
90+ }
8691 }
8792
8893 return builder .build ();
8994 }
9095
91- private void addNonce (OCSPReqBuilder builder ) {
96+ private void addNonce (OCSPReqBuilder builder ) throws IOException {
9297 final byte [] nonce = new byte [32 ];
9398 GENERATOR .nextBytes (nonce );
9499
95100 final Extension [] extensions = new Extension []{
96101 new Extension (OCSPObjectIdentifiers .id_pkix_ocsp_nonce , false ,
97- new DEROctetString (nonce ))
102+ new DEROctetString (new DEROctetString ( nonce ) ))
98103 };
99104 builder .setRequestExtensions (new Extensions (extensions ));
100105 }
You can’t perform that action at this time.
0 commit comments