/**
         * return the maximum possible size for the output.
         */
        public int GetOutputBlockSize()
        {
            int baseBlockSize = engine.GetOutputBlockSize();

            if (forEncryption)
            {
                return(baseBlockSize);
            }
            else
            {
                return((baseBlockSize + 1) / 2);
            }
        }
        private static byte[] TransformInternal(byte[] buffer, IAsymmetricBlockCipher cipher)
        {
            byte[] transformed = cipher.ProcessBlock(buffer, 0, buffer.Length);

            int rsaKeyByteLength = cipher.GetOutputBlockSize();

            if (transformed.Length < rsaKeyByteLength)
            {
                byte[] tmp = new byte[rsaKeyByteLength];
                transformed.CopyTo(tmp, tmp.Length - transformed.Length);
                transformed = tmp;
            }

            return(transformed);
        }
 public override int GetOutputSize(
     int length)
 {
     return(cipher.GetOutputBlockSize());
 }
Example #4
0
        public int GetOutputBlockSize()
        {
            int outputBlockSize = engine.GetOutputBlockSize();

            return((!forEncryption) ? (outputBlockSize - 10) : outputBlockSize);
        }