// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.AspNet.Security.DataProtection { /// /// Represents an object that can perform cryptographic operations. /// public interface IDataProtector : IDisposable { /// /// Given a subpurpose, returns a new IDataProtector that has unique cryptographic keys tied both the purpose /// that was used to create this IDataProtector instance and the purpose that is provided as a parameter /// to this method. /// /// The sub-consumer of the IDataProtector. /// An IDataProtector. IDataProtector CreateSubProtector(string purpose); /// /// Cryptographically protects some input data. /// /// The data to be protected. /// An array containing cryptographically protected data. /// To retrieve the original data, call Unprotect on the protected data. byte[] Protect(byte[] unprotectedData); /// /// Retrieves the original data that was protected by a call to Protect. /// /// The protected data to be decrypted. /// The original data. /// Throws CryptographicException if the protectedData parameter has been tampered with. byte[] Unprotect(byte[] protectedData); } }