jceblockcipher.java
来自「kmlnjlkj nlkjlkjkljl okopokipoipo oipipi」· Java 代码 · 共 1,312 行 · 第 1/3 页
JAVA
1,312 行
extends JCEBlockCipher { public RC564() { super(new RC564Engine()); } } /** * RC6 */ static public class RC6 extends JCEBlockCipher { public RC6() { super(new RC6Engine()); } } /** * AES */ static public class AES extends JCEBlockCipher { public AES() { super(new AESFastEngine()); } } /** * AESCBC */ static public class AESCBC extends JCEBlockCipher { public AESCBC() { super(new CBCBlockCipher(new AESFastEngine()), 128); } } /** * AESCFB */ static public class AESCFB extends JCEBlockCipher { public AESCFB() { super(new CFBBlockCipher(new AESFastEngine(), 128), 128); } } /** * AESOFB */ static public class AESOFB extends JCEBlockCipher { public AESOFB() { super(new OFBBlockCipher(new AESFastEngine(), 128), 128); } } /** * Rijndael */ static public class Rijndael extends JCEBlockCipher { public Rijndael() { super(new RijndaelEngine()); } } /** * Serpent */ static public class Serpent extends JCEBlockCipher { public Serpent() { super(new SerpentEngine()); } } /** * CAST5 */ static public class CAST5 extends JCEBlockCipher { public CAST5() { super(new CAST5Engine()); } } /** * CAST5 CBC */ static public class CAST5CBC extends JCEBlockCipher { public CAST5CBC() { super(new CBCBlockCipher(new CAST5Engine()), 64); } } /** * CAST6 */ static public class CAST6 extends JCEBlockCipher { public CAST6() { super(new CAST6Engine()); } } /** * TEA */ static public class TEA extends JCEBlockCipher { public TEA() { super(new TEAEngine()); } } /** * XTEA */ static public class XTEA extends JCEBlockCipher { public XTEA() { super(new XTEAEngine()); } } /** * SEED */ static public class SEED extends JCEBlockCipher { public SEED() { super(new SEEDEngine()); } } /** * PBEWithMD5AndDES */ static public class PBEWithMD5AndDES extends JCEBlockCipher { public PBEWithMD5AndDES() { super(new CBCBlockCipher(new DESEngine())); } } /** * PBEWithMD5AndRC2 */ static public class PBEWithMD5AndRC2 extends JCEBlockCipher { public PBEWithMD5AndRC2() { super(new CBCBlockCipher(new RC2Engine())); } } /** * PBEWithSHA1AndDES */ static public class PBEWithSHA1AndDES extends JCEBlockCipher { public PBEWithSHA1AndDES() { super(new CBCBlockCipher(new DESEngine())); } } /** * PBEWithSHA1AndRC2 */ static public class PBEWithSHA1AndRC2 extends JCEBlockCipher { public PBEWithSHA1AndRC2() { super(new CBCBlockCipher(new RC2Engine())); } } /** * PBEWithSHAAnd3-KeyTripleDES-CBC */ static public class PBEWithSHAAndDES3Key extends JCEBlockCipher { public PBEWithSHAAndDES3Key() { super(new CBCBlockCipher(new DESedeEngine())); } } /** * PBEWithSHAAnd2-KeyTripleDES-CBC */ static public class PBEWithSHAAndDES2Key extends JCEBlockCipher { public PBEWithSHAAndDES2Key() { super(new CBCBlockCipher(new DESedeEngine())); } } /** * PBEWithSHAAnd128BitRC2-CBC */ static public class PBEWithSHAAnd128BitRC2 extends JCEBlockCipher { public PBEWithSHAAnd128BitRC2() { super(new CBCBlockCipher(new RC2Engine())); } } /** * PBEWithSHAAnd40BitRC2-CBC */ static public class PBEWithSHAAnd40BitRC2 extends JCEBlockCipher { public PBEWithSHAAnd40BitRC2() { super(new CBCBlockCipher(new RC2Engine())); } } /** * PBEWithSHAAndTwofish-CBC */ static public class PBEWithSHAAndTwofish extends JCEBlockCipher { public PBEWithSHAAndTwofish() { super(new CBCBlockCipher(new TwofishEngine())); } } /** * PBEWithAES-CBC */ static public class PBEWithAESCBC extends JCEBlockCipher { public PBEWithAESCBC() { super(new CBCBlockCipher(new AESFastEngine())); } } static private interface GenericBlockCipher { public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException; public boolean wrapOnNoPadding(); public String getAlgorithmName(); public BlockCipher getUnderlyingCipher(); public int getOutputSize(int len); public int getUpdateOutputSize(int len); public int processByte(byte in, byte[] out, int outOff) throws DataLengthException; public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException; public int doFinal(byte[] out, int outOff) throws IllegalStateException, InvalidCipherTextException; } private static class BufferedGenericBlockCipher implements GenericBlockCipher { private BufferedBlockCipher cipher; BufferedGenericBlockCipher(BufferedBlockCipher cipher) { this.cipher = cipher; } BufferedGenericBlockCipher(BlockCipher cipher) { this.cipher = new PaddedBufferedBlockCipher(cipher); } BufferedGenericBlockCipher(BlockCipher cipher, BlockCipherPadding padding) { this.cipher = new PaddedBufferedBlockCipher(cipher, padding); } public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException { cipher.init(forEncryption, params); } public boolean wrapOnNoPadding() { return !(cipher instanceof CTSBlockCipher); } public String getAlgorithmName() { return cipher.getUnderlyingCipher().getAlgorithmName(); } public BlockCipher getUnderlyingCipher() { return cipher.getUnderlyingCipher(); } public int getOutputSize(int len) { return cipher.getOutputSize(len); } public int getUpdateOutputSize(int len) { return cipher.getUpdateOutputSize(len); } public int processByte(byte in, byte[] out, int outOff) throws DataLengthException { return cipher.processByte(in, out, outOff); } public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { return cipher.processBytes(in, inOff, len, out, outOff); } public int doFinal(byte[] out, int outOff) throws IllegalStateException, InvalidCipherTextException { return cipher.doFinal(out, outOff); } } private static class AEADGenericBlockCipher implements GenericBlockCipher { private AEADBlockCipher cipher; AEADGenericBlockCipher(AEADBlockCipher cipher) { this.cipher = cipher; } public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException { cipher.init(forEncryption, params); } public String getAlgorithmName() { return cipher.getUnderlyingCipher().getAlgorithmName(); } public boolean wrapOnNoPadding() { return false; } public BlockCipher getUnderlyingCipher() { return cipher.getUnderlyingCipher(); } public int getOutputSize(int len) { return cipher.getOutputSize(len); } public int getUpdateOutputSize(int len) { return cipher.getUpdateOutputSize(len); } public int processByte(byte in, byte[] out, int outOff) throws DataLengthException { return cipher.processByte(in, out, outOff); } public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { return cipher.processBytes(in, inOff, len, out, outOff); } public int doFinal(byte[] out, int outOff) throws IllegalStateException, InvalidCipherTextException { return cipher.doFinal(out, outOff); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?