?? jceblockcipher.java
字號:
} } protected byte[] engineUpdate( byte[] input, int inputOffset, int inputLen) { int length = cipher.getUpdateOutputSize(inputLen); if (length > 0) { byte[] out = new byte[length]; int len = cipher.processBytes(input, inputOffset, inputLen, out, 0); if (len == 0) { return null; } else if (len != out.length) { byte[] tmp = new byte[len]; System.arraycopy(out, 0, tmp, 0, len); return tmp; } return out; } cipher.processBytes(input, inputOffset, inputLen, null, 0); return null; } protected int engineUpdate( byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException { try { return cipher.processBytes(input, inputOffset, inputLen, output, outputOffset); } catch (DataLengthException e) { throw new ShortBufferException(e.getMessage()); } } protected byte[] engineDoFinal( byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException { int len = 0; byte[] tmp = new byte[engineGetOutputSize(inputLen)]; if (inputLen != 0) { len = cipher.processBytes(input, inputOffset, inputLen, tmp, 0); } try { len += cipher.doFinal(tmp, len); } catch (DataLengthException e) { throw new IllegalBlockSizeException(e.getMessage()); } catch (InvalidCipherTextException e) { throw new BadPaddingException(e.getMessage()); } byte[] out = new byte[len]; System.arraycopy(tmp, 0, out, 0, len); return out; } protected int engineDoFinal( byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws IllegalBlockSizeException, BadPaddingException { int len = 0; if (inputLen != 0) { len = cipher.processBytes(input, inputOffset, inputLen, output, outputOffset); } try { return (len + cipher.doFinal(output, outputOffset + len)); } catch (DataLengthException e) { throw new IllegalBlockSizeException(e.getMessage()); } catch (InvalidCipherTextException e) { throw new BadPaddingException(e.getMessage()); } } /* * The ciphers that inherit from us. */ /** * DES */ static public class DES extends JCEBlockCipher { public DES() { super(new DESEngine()); } } /** * DESCBC */ static public class DESCBC extends JCEBlockCipher { public DESCBC() { super(new CBCBlockCipher(new DESEngine()), 64); } } /** * DESede */ static public class DESede extends JCEBlockCipher { public DESede() { super(new DESedeEngine()); } } /** * DESedeCBC */ static public class DESedeCBC extends JCEBlockCipher { public DESedeCBC() { super(new CBCBlockCipher(new DESedeEngine()), 64); } } /** * GOST28147 */ static public class GOST28147 extends JCEBlockCipher { public GOST28147() { super(new GOST28147Engine()); } } static public class GOST28147cbc extends JCEBlockCipher { public GOST28147cbc() { super(new CBCBlockCipher(new GOST28147Engine()), 64); } } /** * SKIPJACK */ static public class Skipjack extends JCEBlockCipher { public Skipjack() { super(new SkipjackEngine()); } } /** * Blowfish */ static public class Blowfish extends JCEBlockCipher { public Blowfish() { super(new BlowfishEngine()); } } /** * Twofish */ static public class Twofish extends JCEBlockCipher { public Twofish() { super(new TwofishEngine()); } } /** * RC2 */ static public class RC2 extends JCEBlockCipher { public RC2() { super(new RC2Engine()); } } /** * RC2CBC */ static public class RC2CBC extends JCEBlockCipher { public RC2CBC() { super(new CBCBlockCipher(new RC2Engine()), 64); } } /** * RC5 */ static public class RC5 extends JCEBlockCipher { public RC5() { super(new RC532Engine()); } } /** * RC564 */ static public class RC564 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()); } } /** * Camellia */ static public class Camellia extends JCEBlockCipher { public Camellia() { super(new CamelliaEngine()); } } /** * 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()); } } /** * IDEA */ static public class IDEA extends JCEBlockCipher { public IDEA() { super(new IDEAEngine()); } } /** * IDEA CBC */ static public class IDEACBC extends JCEBlockCipher { public IDEACBC() { super(new CBCBlockCipher(new IDEAEngine()), 64); } } /** * 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())); } } /** * PBEWithSHAAndIDEA-CBC */ static public class PBEWithSHAAndIDEA extends JCEBlockCipher { public PBEWithSHAAndIDEA() { super(new CBCBlockCipher(new IDEAEngine())); } } /** * PBEWithAES-CBC */ static public class PBEWithAESCBC extends JCEBlockCipher { public PBEWithAESCBC() { super(new CBCBlockCipher(new AESFastEngine())); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -