private void CipherUpdate(bool isCipher, int length, byte[] buf, byte[] outBuf)
 {
     if (_disposed)
     {
         throw new ObjectDisposedException(this.ToString());
     }
     if (MbedTLS.cipher_update(isCipher ? _encryptCtx : _decryptCtx, buf, length, outBuf, ref length) != 0)
     {
         throw new EncryptorException("Cannot update mbed TLS cipher context");
     }
 }
Beispiel #2
0
 private void CipherUpdate(byte[] buf, int length, byte[] outBuf)
 {
     Contract.Requires(buf != outBuf);//outBuf不能跟buf相同,outBuf的长度不小于length+block_size;
     if (_disposed)
     {
         throw new ObjectDisposedException(this.ToString());
     }
     if (MbedTLS.cipher_update(_ctx, buf, length, outBuf, ref length) != 0)
     {
         throw new EncryptorException("Cannot update mbed TLS cipher context");
     }
     //int ret = MbedTLS.cipher_update(_ctx, buf, length, outBuf, ref length);
 }