@Override public Digest getHash() throws Exception { return factory.create(); } }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param s The {@link String} to digest - ignored if {@code null}/empty * @param charset The {@link Charset} to use in order to convert the * string to its byte representation to use as input for the fingerprint * @return The fingerprint - {@code null} if {@code null}/empty input * @throws Exception If failed to calculate the digest */ public static String getFingerPrint(Factory<? extends Digest> f, String s, Charset charset) throws Exception { return getFingerPrint(Objects.requireNonNull(f, "No factory").create(), s, charset); }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
@Override public Channel create() { CloseableExecutorService executorService = executorServiceFactory != null ? executorServiceFactory.create() : null; ChannelAgentForwarding channel = new ChannelAgentForwarding(executorService); return channel; } }
public static byte[] getRawFingerprint(Factory<? extends Digest> f, PublicKey key) throws Exception { return (key == null) ? null : getRawFingerprint(Objects.requireNonNull(f, "No digest factory").create(), key); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param buf The data buffer to be fingerprint-ed * @param offset The offset of the data in the buffer * @param len The length of data - ignored if non-positive * @return The fingerprint - {@code null} if non-positive length * @throws Exception If failed to calculate the fingerprint */ public static String getFingerPrint(Factory<? extends Digest> f, byte[] buf, int offset, int len) throws Exception { return getFingerPrint(Objects.requireNonNull(f, "No factory").create(), buf, offset, len); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param s The {@link String} to digest - ignored if {@code null}/empty * @param charset The {@link Charset} to use in order to convert the * string to its byte representation to use as input for the fingerprint * @return The fingerprint - {@code null} if {@code null}/empty input * <B>Note:</B> if exception encountered then returns the exception's simple class name * @see DigestUtils#getFingerPrint(Digest, String, Charset) */ public static String getFingerPrint(Factory<? extends Digest> f, String s, Charset charset) { return getFingerPrint(f.create(), s, charset); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param buf The data buffer to be fingerprint-ed * @param offset The offset of the data in the buffer * @param len The length of data - ignored if non-positive * @return The fingerprint - {@code null} if non-positive length * @throws Exception If failed to calculate the fingerprint */ public static String getFingerPrint(Factory<? extends Digest> f, byte[] buf, int offset, int len) throws Exception { return getFingerPrint(Objects.requireNonNull(f, "No factory").create(), buf, offset, len); }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param s The {@link String} to digest - ignored if {@code null}/empty * @param charset The {@link Charset} to use in order to convert the * string to its byte representation to use as input for the fingerprint * @return The fingerprint - {@code null} if {@code null}/empty input * <B>Note:</B> if exception encountered then returns the exception's simple class name * @see DigestUtils#getFingerPrint(Digest, String, Charset) */ public static String getFingerPrint(Factory<? extends Digest> f, String s, Charset charset) { return getFingerPrint(f.create(), s, charset); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param s The {@link String} to digest - ignored if {@code null}/empty * @param charset The {@link Charset} to use in order to convert the * string to its byte representation to use as input for the fingerprint * @return The fingerprint - {@code null} if {@code null}/empty input * @throws Exception If failed to calculate the digest */ public static String getFingerPrint(Factory<? extends Digest> f, String s, Charset charset) throws Exception { return getFingerPrint(Objects.requireNonNull(f, "No factory").create(), s, charset); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param key the public key - ignored if {@code null} * @return the fingerprint or {@code null} if no key. * <B>Note:</B> if exception encountered then returns the exception's simple class name * @see #getFingerPrint(Digest, PublicKey) */ public static String getFingerPrint(Factory<? extends Digest> f, PublicKey key) { return (key == null) ? null : getFingerPrint(Objects.requireNonNull(f, "No digest factory").create(), key); }
/** * @param f The {@link Factory} to create the {@link Digest} to use * @param key the public key - ignored if {@code null} * @return the fingerprint or {@code null} if no key. * <B>Note:</B> if exception encountered then returns the exception's simple class name * @see #getFingerPrint(Digest, PublicKey) */ public static String getFingerPrint(Factory<? extends Digest> f, PublicKey key) { return (key == null) ? null : getFingerPrint(Objects.requireNonNull(f, "No digest factory").create(), key); }
/** * @param expected The expected fingerprint if {@code null} or empty then returns a failure * with the default fingerprint. * @param f The {@link Factory} to be used to generate the default {@link Digest} for the key * @param key the {@link PublicKey} - if {@code null} then returns null. * @return SimpleImmutableEntry<Boolean, String> - key is success indicator, value is actual fingerprint, * {@code null} if no key. */ public static SimpleImmutableEntry<Boolean, String> checkFingerPrint(String expected, Factory<? extends Digest> f, PublicKey key) { return checkFingerPrint(expected, Objects.requireNonNull(f, "No digest factory").create(), key); }
@Override public Channel create() { CloseableExecutorService executorService = executorServiceFactory != null ? executorServiceFactory.create() : null; ChannelAgentForwarding channel = new ChannelAgentForwarding(executorService); return channel; } }
/** * @param expected The expected fingerprint if {@code null} or empty then returns a failure * with the default fingerprint. * @param f The {@link Factory} to be used to generate the default {@link Digest} for the key * @param key the {@link PublicKey} - if {@code null} then returns null. * @return SimpleImmutableEntry<Boolean, String> - key is success indicator, value is actual fingerprint, * {@code null} if no key. */ public static SimpleImmutableEntry<Boolean, String> checkFingerPrint(String expected, Factory<? extends Digest> f, PublicKey key) { return checkFingerPrint(expected, Objects.requireNonNull(f, "No digest factory").create(), key); }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
@Override public Command createCommand(String command) { Factory<Command> factory = new ProcessShellFactory(GenericUtils.split(command, ' ')); return factory.create(); } }
@Override public Command createCommand(String command) { Factory<Command> factory = new ProcessShellFactory(GenericUtils.split(command, ' ')); return factory.create(); } }