@Override public final boolean isSupported() { return SecurityUtils.isECCSupported() && digestFactory.isSupported(); }
/** * @return The {@link Digest} to use when hashing the curve's parameters */ public final Digest getDigestForParams() { return digestFactory.create(); }
/** * @return The default {@link DigestFactory} * by the {@link #getFingerPrint(PublicKey)} and {@link #getFingerPrint(String)} * methods * @see #KEY_FINGERPRINT_FACTORY_PROP * @see #setDefaultFingerPrintFactory(DigestFactory) */ public static DigestFactory getDefaultFingerPrintFactory() { DigestFactory factory = null; synchronized (DEFAULT_DIGEST_HOLDER) { factory = DEFAULT_DIGEST_HOLDER.get(); if (factory != null) { return factory; } String propVal = System.getProperty(KEY_FINGERPRINT_FACTORY_PROP); if (GenericUtils.isEmpty(propVal)) { factory = DEFAULT_FINGERPRINT_DIGEST_FACTORY; } else { factory = ValidateUtils.checkNotNull(BuiltinDigests.fromFactoryName(propVal), "Unknown digest factory: %s", propVal); } ValidateUtils.checkTrue(factory.isSupported(), "Selected fingerprint digest not supported: %s", factory.getName()); DEFAULT_DIGEST_HOLDER.set(factory); } return factory; }
/** * @param <F> The generic type of digest factory * @param algo The required algorithm name - ignored if {@code null}/empty * @param comp The {@link Comparator} to use to compare algorithm names * @param factories The factories to check - ignored if {@code null}/empty * @return The first {@link DigestFactory} whose algorithm matches the required one * according to the comparator - {@code null} if no match found */ public static <F extends DigestFactory> F findFactoryByAlgorithm(String algo, Comparator<? super String> comp, Collection<? extends F> factories) { if (GenericUtils.isEmpty(algo) || GenericUtils.isEmpty(factories)) { return null; } for (F f : factories) { if (comp.compare(algo, f.getAlgorithm()) == 0) { return f; } } return null; }
/** * @return The default {@link DigestFactory} * by the {@link #getFingerPrint(PublicKey)} and {@link #getFingerPrint(String)} * methods * @see #KEY_FINGERPRINT_FACTORY_PROP * @see #setDefaultFingerPrintFactory(DigestFactory) */ public static DigestFactory getDefaultFingerPrintFactory() { DigestFactory factory = null; synchronized (DEFAULT_DIGEST_HOLDER) { factory = DEFAULT_DIGEST_HOLDER.get(); if (factory != null) { return factory; } String propVal = System.getProperty(KEY_FINGERPRINT_FACTORY_PROP); if (GenericUtils.isEmpty(propVal)) { factory = DEFAULT_FINGERPRINT_DIGEST_FACTORY; } else { factory = ValidateUtils.checkNotNull(BuiltinDigests.fromFactoryName(propVal), "Unknown digest factory: %s", propVal); } ValidateUtils.checkTrue(factory.isSupported(), "Selected fingerprint digest not supported: %s", factory.getName()); DEFAULT_DIGEST_HOLDER.set(factory); } return factory; }
/** * @param <F> The generic type of digest factory * @param algo The required algorithm name - ignored if {@code null}/empty * @param comp The {@link Comparator} to use to compare algorithm names * @param factories The factories to check - ignored if {@code null}/empty * @return The first {@link DigestFactory} whose algorithm matches the required one * according to the comparator - {@code null} if no match found */ public static <F extends DigestFactory> F findFactoryByAlgorithm(String algo, Comparator<? super String> comp, Collection<? extends F> factories) { if (GenericUtils.isEmpty(algo) || GenericUtils.isEmpty(factories)) { return null; } for (F f : factories) { if (comp.compare(algo, f.getAlgorithm()) == 0) { return f; } } return null; }
@Override public final boolean isSupported() { return SecurityUtils.isECCSupported() && digestFactory.isSupported(); }
/** * @return The {@link Digest} to use when hashing the curve's parameters */ public final Digest getDigestForParams() { return digestFactory.create(); }
for (String a : algos) { factory = BuiltinDigests.fromFactoryName(a); if ((factory != null) && factory.isSupported()) { break;