小编Евг*_*тин的帖子

bouncycastle 连接到 android studio

一天中的好时光,我需要以某种方式将 bouncycastle 库连接到 android studio。如何才能做到这一点?我以前从未处理过一个。这是我需要这个库的代码:

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        byte[] input = "www.javaCODEgeeks.com".getBytes();
        byte[] keyBytes = new byte[]{0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, (byte) 0xcd,


                (byte) 0xef};



        byte[] ivBytes = new byte[]{0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};


        SecretKeySpec pKey = new SecretKeySpec(keyBytes, "DES");

        IvParameterSpec ivectorSpecv = new IvParameterSpec(ivBytes);

        Cipher c = Cipher.getInstance("DES/CBC/PKCS7Padding", "BC");


        System.out.println("input : " + new String(input));


        // encryption pass


        c.init(Cipher.ENCRYPT_MODE, pKey, ivectorSpecv);


        byte[] encr = new byte;


        int ctLen = c.update(input, 0, input.length, encr, 0); …
Run Code Online (Sandbox Code Playgroud)

android bouncycastle

3
推荐指数
1
解决办法
5108
查看次数

标签 统计

android ×1

bouncycastle ×1