@@ -114,7 +114,7 @@ public CompletableFuture<VerificationResult> verifyAsync(final Request request)
114114 }
115115
116116 byte [] provided = extractSignature (headerValue );
117- if (provided == null ) {
117+ if (provided == null || provided . length == 0 ) {
118118 return VerificationResult .failure (
119119 "Malformed signature header '" + signatureHeaderName + "'." );
120120 }
@@ -145,7 +145,7 @@ private byte[] extractSignature(final String headerValue) {
145145 try {
146146 int index = signatureValueTemplate .indexOf (SIGNATURE_VALUE_PLACEHOLDER );
147147 if (index < 0 ) {
148- return null ;
148+ return new byte [ 0 ] ;
149149 }
150150
151151 String prefix = signatureValueTemplate .substring (0 , index );
@@ -155,7 +155,7 @@ private byte[] extractSignature(final String headerValue) {
155155 // find prefix anywhere (case-insensitive)
156156 int prefixAt = indexOfIgnoreCase (headerValue , prefix , 0 );
157157 if (prefixAt < 0 ) {
158- return null ;
158+ return new byte [ 0 ] ;
159159 }
160160
161161 int digestStart = prefixAt + prefix .length ();
@@ -167,12 +167,12 @@ private byte[] extractSignature(final String headerValue) {
167167 } else {
168168 digestEnd = indexOfIgnoreCase (headerValue , suffix , digestStart );
169169 if (digestEnd < 0 ) {
170- return null ;
170+ return new byte [ 0 ] ;
171171 }
172172 }
173173
174174 if (digestEnd < digestStart ) {
175- return null ;
175+ return new byte [ 0 ] ;
176176 }
177177
178178 String digest = headerValue .substring (digestStart , digestEnd ).trim ();
@@ -185,7 +185,7 @@ private byte[] extractSignature(final String headerValue) {
185185 byte [] decoded = digestCodec .decode (digest );
186186 return (decoded == null || decoded .length == 0 ) ? null : decoded ;
187187 } catch (Exception e ) {
188- return null ;
188+ return new byte [ 0 ] ;
189189 }
190190 }
191191
0 commit comments