Exemplo n.º 1
0
 // see JCE spec
 protected byte[] engineUpdate(byte[] in, int inOfs, int inLen) {
   try {
     byte[] out = new byte[updateLength(inLen)];
     int n = engineUpdate(in, inOfs, inLen, out, 0);
     return P11Util.convert(out, 0, n);
   } catch (ShortBufferException e) {
     // convert since the output length is calculated by updateLength()
     throw new ProviderException(e);
   }
 }
Exemplo n.º 2
0
 // see JCE spec
 protected byte[] engineDoFinal(byte[] in, int inOfs, int inLen)
     throws IllegalBlockSizeException, BadPaddingException {
   try {
     byte[] out = new byte[doFinalLength(inLen)];
     int n = engineDoFinal(in, inOfs, inLen, out, 0);
     return P11Util.convert(out, 0, n);
   } catch (ShortBufferException e) {
     // convert since the output length is calculated by doFinalLength()
     throw new ProviderException(e);
   }
 }
Exemplo n.º 3
0
 // see JCE spec
 protected AlgorithmParameters engineGetParameters() {
   if (iv == null) {
     return null;
   }
   IvParameterSpec ivSpec = new IvParameterSpec(iv);
   try {
     AlgorithmParameters params =
         AlgorithmParameters.getInstance(keyAlgorithm, P11Util.getSunJceProvider());
     params.init(ivSpec);
     return params;
   } catch (GeneralSecurityException e) {
     // NoSuchAlgorithmException, NoSuchProviderException
     // InvalidParameterSpecException
     throw new ProviderException("Could not encode parameters", e);
   }
 }