Exemplo n.º 1
0
 protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)
     throws InvalidKeyException, InvalidAlgorithmParameterException {
   if (params != null && params instanceof RC2ParameterSpec) {
     embeddedCipher.initEffectiveKeyBits(((RC2ParameterSpec) params).getEffectiveKeyBits());
   } else {
     embeddedCipher.initEffectiveKeyBits(0);
   }
   core.init(opmode, key, params, random);
 }
Exemplo n.º 2
0
 protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)
     throws InvalidKeyException, InvalidAlgorithmParameterException {
   if (params != null && params.getAlgorithm().equals("RC2")) {
     try {
       RC2ParameterSpec rc2Params = params.getParameterSpec(RC2ParameterSpec.class);
       engineInit(opmode, key, rc2Params, random);
     } catch (InvalidParameterSpecException ipse) {
       throw new InvalidAlgorithmParameterException("Wrong parameter type: RC2 expected");
     }
   } else {
     embeddedCipher.initEffectiveKeyBits(0);
     core.init(opmode, key, params, random);
   }
 }
Exemplo n.º 3
0
 protected AlgorithmParameters engineGetParameters() {
   return core.getParameters("RC2");
 }
Exemplo n.º 4
0
 protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException {
   embeddedCipher.initEffectiveKeyBits(0);
   core.init(opmode, key, random);
 }
Exemplo n.º 5
0
 protected int engineGetOutputSize(int inputLen) {
   return core.getOutputSize(inputLen);
 }
Exemplo n.º 6
0
 protected byte[] engineGetIV() {
   return core.getIV();
 }
Exemplo n.º 7
0
 protected void engineSetMode(String mode) throws NoSuchAlgorithmException {
   core.setMode(mode);
 }
Exemplo n.º 8
0
 protected void engineSetPadding(String paddingScheme) throws NoSuchPaddingException {
   core.setPadding(paddingScheme);
 }
Exemplo n.º 9
0
 protected byte[] engineWrap(Key key) throws IllegalBlockSizeException, InvalidKeyException {
   return core.wrap(key);
 }
Exemplo n.º 10
0
 protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType)
     throws InvalidKeyException, NoSuchAlgorithmException {
   return core.unwrap(wrappedKey, wrappedKeyAlgorithm, wrappedKeyType);
 }
Exemplo n.º 11
0
 protected int engineGetKeySize(Key key) throws InvalidKeyException {
   byte[] keyBytes = CipherCore.getKeyBytes(key);
   RC2Crypt.checkKey(key.getAlgorithm(), keyBytes.length);
   return keyBytes.length << 3;
 }
Exemplo n.º 12
0
 protected int engineDoFinal(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)
     throws IllegalBlockSizeException, ShortBufferException, BadPaddingException {
   return core.doFinal(in, inOfs, inLen, out, outOfs);
 }
Exemplo n.º 13
0
 protected byte[] engineDoFinal(byte[] in, int inOfs, int inLen)
     throws IllegalBlockSizeException, BadPaddingException {
   return core.doFinal(in, inOfs, inLen);
 }
Exemplo n.º 14
0
 protected int engineUpdate(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)
     throws ShortBufferException {
   return core.update(in, inOfs, inLen, out, outOfs);
 }
Exemplo n.º 15
0
 protected byte[] engineUpdate(byte[] in, int inOfs, int inLen) {
   return core.update(in, inOfs, inLen);
 }