[System.Security.SecurityCritical] // auto-generated private void ProtectMemory(SafeBSTRHandle decryptedBuffer) { Debug.Assert(!decryptedBuffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength == 0) { return; } try { SafeBSTRHandle newEncryptedBuffer = null; if (Interop.Crypt32.CryptProtectData(decryptedBuffer, out newEncryptedBuffer)) { _encryptedBuffer.Dispose(); _encryptedBuffer = newEncryptedBuffer; } else { throw new CryptographicException(Marshal.GetLastWin32Error()); } } finally { decryptedBuffer.ClearBuffer(); } }
public void Clear() { EnsureNotDisposed(); EnsureNotReadOnly(); m_length = 0; m_buffer.ClearBuffer(); m_encrypted = false; }
[System.Security.SecuritySafeCritical] // auto-generated public void Clear() { lock (_methodLock) { EnsureNotDisposed(); EnsureNotReadOnly(); _decryptedLength = 0; _encryptedBuffer.ClearBuffer(); } }
[System.Security.SecurityCritical] // auto-generated private void ProtectMemory(SafeBSTRHandle decryptedBuffer) { Debug.Assert(!decryptedBuffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength == 0) { return; } try { SafeBSTRHandle newEncryptedBuffer = null; if (Interop.Crypt32.CryptProtectData(decryptedBuffer, out newEncryptedBuffer)) { _encryptedBuffer.Dispose(); _encryptedBuffer = newEncryptedBuffer; } else { throw new CryptographicException(Marshal.GetLastWin32Error()); } } finally { decryptedBuffer.ClearBuffer(); decryptedBuffer.Dispose(); } }