Example #1
0
        /// <summary>
        /// Process asymmetric data using a custom expected length.
        /// The output will ALWAYS be resized to fit expected length
        /// </summary>
        public override byte[] ProcessWithLength(bool encrypting, byte[] in_data, ICipherParameters keyParameter, out int length)
        {
            BufferedAsymmetricBlockCipher bcipher = new BufferedAsymmetricBlockCipher(new RsaEngine());

            bcipher.Init(encrypting, keyParameter);

            byte[] out_data = new byte[bcipher.GetOutputSize(in_data.Length)];
            int    len      = bcipher.DoFinal(in_data, out_data, 0);

            length = len;
            return(out_data);
        }
Example #2
0
 public BufferedCipherTransform(BufferedAsymmetricBlockCipher cipher)
 {
     _cipher         = cipher;
     InputBlockSize  = _cipher.GetBlockSize();
     OutputBlockSize = _cipher.GetOutputSize(0);
 }