ResourceRequestUtil { public static boolean isSigned(URI uri) { List<NameValuePair> queryStringParameters = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8.toString()); boolean hasKeyId = false; boolean hasPolicy = false; boolean hasSignature = false; for (NameValuePair parameter : queryStringParameters) { if (parameter.getName().equals(ResourceRequest.ENCRYPTION_ID_KEY)) { hasKeyId = true; } else if (parameter.getName().equals(ResourceRequest.POLICY_KEY)) { hasPolicy = true; } else if (parameter.getName().equals(ResourceRequest.SIGNATURE_KEY)) { hasSignature = true; } } return hasKeyId && hasPolicy && hasSignature; } private  ResourceRequestUtil(); static String policyToResourceRequestQueryString(Policy policy, String encryptionKeyId, String encryptionKey); static String resourceRequestToQueryString(ResourceRequest resourceRequest); static ResourceRequest resourceRequestFromQueryString(String queryString, String clientIp, String resourceUri,
          Properties encryptionKeys, boolean strict); static boolean isNotSigned(URI uri); static boolean isSigned(URI uri);  }
@Test public void testIsSigned() throws URISyntaxException { String noQueryString = "http: String wrongQueryString = "http: String signed = "http: assertFalse(ResourceRequestUtil.isSigned(new URI(noQueryString))); assertFalse(ResourceRequestUtil.isSigned(new URI(wrongQueryString))); assertTrue(ResourceRequestUtil.isSigned(new URI(signed))); }