Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Use RC4 with Cipher

So, how do I do it? Can't find any example anywhere that successfully uses RC4. Also, doing cipher = Cipher.getInstance("RC4"); returns a NoSuchAlgorithm exception

like image 674
josephus Avatar asked Feb 02 '26 06:02

josephus


1 Answers

If you list the available Ciphers:

    Provider[] providers = Security.getProviders();
    for (Provider provider : providers) {
        for (Object entry : provider.keySet()) {
            String name = String.valueOf(entry);
            if (name.startsWith("Cipher")) {
                Log.d("Cipher", "Supports: " + name.substring(7));
            }
        }
    }

There's a few RC4 variants - such as PBEWITHSHAAND128BITRC4 (PKCS#5). Which one do you need?

like image 144
Jens Avatar answered Feb 04 '26 00:02

Jens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!