private boolean isUnsupported(final Class<? extends Credential> testCredentialType, final String testAlgorithmName, final AlgorithmParameterSpec testParameterSpec) { return credentialType.isAssignableFrom(testCredentialType) && (algorithmName == null || algorithmName.equals(testAlgorithmName)) && (parameterSpec == null || KeyUtil.parametersEqual(parameterSpec, testParameterSpec)); }
/** * Determine if the given key has parameters which match the given parameters. * * @param key the key (must not be {@code null}) * @param parameters the parameters (must not be {@code null}) * @return {@code true} if the parameters match, {@code false} otherwise */ public static boolean hasParameters(final Key key, final AlgorithmParameterSpec parameters) { Assert.checkNotNullParam("key", key); Assert.checkNotNullParam("parameters", parameters); final AlgorithmParameterSpec keyParameters = getParameters(key, AlgorithmParameterSpec.class); return keyParameters != null && parametersEqual(keyParameters, parameters); }
/** * Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a * given type and algorithm must override this method. * * @param credentialType the credential type class (must not be {@code null}) * @param algorithmName the algorithm name, or {@code null} if any algorithm is acceptable or the credential type * does not support algorithm names * @param parameterSpec the algorithm parameters to match, or {@code null} if any parameters are acceptable or the credential type * does not support algorithm parameters * @param <C> the credential type * * @return the credential, or {@code null} if no such credential exists * * @throws RealmUnavailableException if the realm is not able to handle requests for any reason */ default <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException { final C credential = getCredential(credentialType, algorithmName); if (parameterSpec != null) { if (! (credential instanceof AlgorithmCredential)) { return null; } return KeyUtil.parametersEqual(parameterSpec, ((AlgorithmCredential) credential).getParameters()) ? credential : null; } else { return credential; } }
/** * Attempt to determine if the two keys have the same parameters. This method returns {@code true} if the keys * definitely have the same parameters, or {@code false} if they do not or if parameter equivalency cannot be determined. * * @param key1 the first key (must not be {@code null}) * @param key2 the second key (must not be {@code null}) * @return {@code true} if the parameters are definitely equal, {@code false} otherwise */ public static boolean hasSameParameters(final Key key1, final Key key2) { Assert.checkNotNullParam("key1", key1); Assert.checkNotNullParam("key2", key2); final AlgorithmParameterSpec param1 = getParameters(key1, AlgorithmParameterSpec.class); final AlgorithmParameterSpec param2 = getParameters(key2, AlgorithmParameterSpec.class); return param1 == null && param2 == null || param1 != null && param2 != null && parametersEqual(param1, param2); }
final AlgorithmParameterSpec param1 = pbe1.getParameterSpec(); final AlgorithmParameterSpec param2 = pbe2.getParameterSpec(); return pbe1.getIterationCount() == pbe2.getIterationCount() && Arrays.equals(pbe1.getSalt(), pbe2.getSalt()) && (param1 == null ? param2 == null : param2 != null && parametersEqual(param1, param2)); } else if (p1 instanceof IvParameterSpec && p2 instanceof IvParameterSpec) { final IvParameterSpec iv1 = (IvParameterSpec) p1;
private boolean isUnsupported(final Class<? extends Credential> testCredentialType, final String testAlgorithmName, final AlgorithmParameterSpec testParameterSpec) { return credentialType.isAssignableFrom(testCredentialType) && (algorithmName == null || algorithmName.equals(testAlgorithmName)) && (parameterSpec == null || KeyUtil.parametersEqual(parameterSpec, testParameterSpec)); }
private boolean isUnsupported(final Class<? extends Credential> testCredentialType, final String testAlgorithmName, final AlgorithmParameterSpec testParameterSpec) { return credentialType.isAssignableFrom(testCredentialType) && (algorithmName == null || algorithmName.equals(testAlgorithmName)) && (parameterSpec == null || KeyUtil.parametersEqual(parameterSpec, testParameterSpec)); }
private boolean isUnsupported(final Class<? extends Credential> testCredentialType, final String testAlgorithmName, final AlgorithmParameterSpec testParameterSpec) { return credentialType.isAssignableFrom(testCredentialType) && (algorithmName == null || algorithmName.equals(testAlgorithmName)) && (parameterSpec == null || KeyUtil.parametersEqual(parameterSpec, testParameterSpec)); }
/** * Determine if the given key has parameters which match the given parameters. * * @param key the key (must not be {@code null}) * @param parameters the parameters (must not be {@code null}) * @return {@code true} if the parameters match, {@code false} otherwise */ public static boolean hasParameters(final Key key, final AlgorithmParameterSpec parameters) { Assert.checkNotNullParam("key", key); Assert.checkNotNullParam("parameters", parameters); final AlgorithmParameterSpec keyParameters = getParameters(key, AlgorithmParameterSpec.class); return keyParameters != null && parametersEqual(keyParameters, parameters); }
/** * Determine if the given key has parameters which match the given parameters. * * @param key the key (must not be {@code null}) * @param parameters the parameters (must not be {@code null}) * @return {@code true} if the parameters match, {@code false} otherwise */ public static boolean hasParameters(final Key key, final AlgorithmParameterSpec parameters) { Assert.checkNotNullParam("key", key); Assert.checkNotNullParam("parameters", parameters); final AlgorithmParameterSpec keyParameters = getParameters(key, AlgorithmParameterSpec.class); return keyParameters != null && parametersEqual(keyParameters, parameters); }
/** * Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a * given type and algorithm must override this method. * * @param credentialType the credential type class (must not be {@code null}) * @param algorithmName the algorithm name, or {@code null} if any algorithm is acceptable or the credential type * does not support algorithm names * @param parameterSpec the algorithm parameters to match, or {@code null} if any parameters are acceptable or the credential type * does not support algorithm parameters * @param <C> the credential type * * @return the credential, or {@code null} if no such credential exists * * @throws RealmUnavailableException if the realm is not able to handle requests for any reason */ default <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException { final C credential = getCredential(credentialType, algorithmName); if (parameterSpec != null) { if (! (credential instanceof AlgorithmCredential)) { return null; } return KeyUtil.parametersEqual(parameterSpec, ((AlgorithmCredential) credential).getParameters()) ? credential : null; } else { return credential; } }
/** * Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a * given type and algorithm must override this method. * * @param credentialType the credential type class (must not be {@code null}) * @param algorithmName the algorithm name, or {@code null} if any algorithm is acceptable or the credential type * does not support algorithm names * @param parameterSpec the algorithm parameters to match, or {@code null} if any parameters are acceptable or the credential type * does not support algorithm parameters * @param <C> the credential type * * @return the credential, or {@code null} if no such credential exists * * @throws RealmUnavailableException if the realm is not able to handle requests for any reason */ default <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException { final C credential = getCredential(credentialType, algorithmName); if (parameterSpec != null) { if (! (credential instanceof AlgorithmCredential)) { return null; } return KeyUtil.parametersEqual(parameterSpec, ((AlgorithmCredential) credential).getParameters()) ? credential : null; } else { return credential; } }
/** * Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a * given type and algorithm must override this method. * * @param credentialType the credential type class (must not be {@code null}) * @param algorithmName the algorithm name, or {@code null} if any algorithm is acceptable or the credential type * does not support algorithm names * @param parameterSpec the algorithm parameters to match, or {@code null} if any parameters are acceptable or the credential type * does not support algorithm parameters * @param <C> the credential type * * @return the credential, or {@code null} if no such credential exists * * @throws RealmUnavailableException if the realm is not able to handle requests for any reason */ default <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException { final C credential = getCredential(credentialType, algorithmName); if (parameterSpec != null) { if (! (credential instanceof AlgorithmCredential)) { return null; } return KeyUtil.parametersEqual(parameterSpec, ((AlgorithmCredential) credential).getParameters()) ? credential : null; } else { return credential; } }
/** * Determine if the given key has parameters which match the given parameters. * * @param key the key (must not be {@code null}) * @param parameters the parameters (must not be {@code null}) * @return {@code true} if the parameters match, {@code false} otherwise */ public static boolean hasParameters(final Key key, final AlgorithmParameterSpec parameters) { Assert.checkNotNullParam("key", key); Assert.checkNotNullParam("parameters", parameters); final AlgorithmParameterSpec keyParameters = getParameters(key, AlgorithmParameterSpec.class); return keyParameters != null && parametersEqual(keyParameters, parameters); }
/** * Attempt to determine if the two keys have the same parameters. This method returns {@code true} if the keys * definitely have the same parameters, or {@code false} if they do not or if parameter equivalency cannot be determined. * * @param key1 the first key (must not be {@code null}) * @param key2 the second key (must not be {@code null}) * @return {@code true} if the parameters are definitely equal, {@code false} otherwise */ public static boolean hasSameParameters(final Key key1, final Key key2) { Assert.checkNotNullParam("key1", key1); Assert.checkNotNullParam("key2", key2); final AlgorithmParameterSpec param1 = getParameters(key1, AlgorithmParameterSpec.class); final AlgorithmParameterSpec param2 = getParameters(key2, AlgorithmParameterSpec.class); return param1 == null && param2 == null || param1 != null && param2 != null && parametersEqual(param1, param2); }
/** * Attempt to determine if the two keys have the same parameters. This method returns {@code true} if the keys * definitely have the same parameters, or {@code false} if they do not or if parameter equivalency cannot be determined. * * @param key1 the first key (must not be {@code null}) * @param key2 the second key (must not be {@code null}) * @return {@code true} if the parameters are definitely equal, {@code false} otherwise */ public static boolean hasSameParameters(final Key key1, final Key key2) { Assert.checkNotNullParam("key1", key1); Assert.checkNotNullParam("key2", key2); final AlgorithmParameterSpec param1 = getParameters(key1, AlgorithmParameterSpec.class); final AlgorithmParameterSpec param2 = getParameters(key2, AlgorithmParameterSpec.class); return param1 == null && param2 == null || param1 != null && param2 != null && parametersEqual(param1, param2); }
/** * Attempt to determine if the two keys have the same parameters. This method returns {@code true} if the keys * definitely have the same parameters, or {@code false} if they do not or if parameter equivalency cannot be determined. * * @param key1 the first key (must not be {@code null}) * @param key2 the second key (must not be {@code null}) * @return {@code true} if the parameters are definitely equal, {@code false} otherwise */ public static boolean hasSameParameters(final Key key1, final Key key2) { Assert.checkNotNullParam("key1", key1); Assert.checkNotNullParam("key2", key2); final AlgorithmParameterSpec param1 = getParameters(key1, AlgorithmParameterSpec.class); final AlgorithmParameterSpec param2 = getParameters(key2, AlgorithmParameterSpec.class); return param1 == null && param2 == null || param1 != null && param2 != null && parametersEqual(param1, param2); }
final AlgorithmParameterSpec param1 = pbe1.getParameterSpec(); final AlgorithmParameterSpec param2 = pbe2.getParameterSpec(); return pbe1.getIterationCount() == pbe2.getIterationCount() && Arrays.equals(pbe1.getSalt(), pbe2.getSalt()) && (param1 == null ? param2 == null : param2 != null && parametersEqual(param1, param2)); } else if (p1 instanceof IvParameterSpec && p2 instanceof IvParameterSpec) { final IvParameterSpec iv1 = (IvParameterSpec) p1;
final AlgorithmParameterSpec param1 = pbe1.getParameterSpec(); final AlgorithmParameterSpec param2 = pbe2.getParameterSpec(); return pbe1.getIterationCount() == pbe2.getIterationCount() && Arrays.equals(pbe1.getSalt(), pbe2.getSalt()) && (param1 == null ? param2 == null : param2 != null && parametersEqual(param1, param2)); } else if (p1 instanceof IvParameterSpec && p2 instanceof IvParameterSpec) { final IvParameterSpec iv1 = (IvParameterSpec) p1;
final AlgorithmParameterSpec param1 = pbe1.getParameterSpec(); final AlgorithmParameterSpec param2 = pbe2.getParameterSpec(); return pbe1.getIterationCount() == pbe2.getIterationCount() && Arrays.equals(pbe1.getSalt(), pbe2.getSalt()) && (param1 == null ? param2 == null : param2 != null && parametersEqual(param1, param2)); } else if (p1 instanceof IvParameterSpec && p2 instanceof IvParameterSpec) { final IvParameterSpec iv1 = (IvParameterSpec) p1;