/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EverestCryptographyEverest.Library.Providers.Cryptography;
using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;
namespace Everest.Providers.Cryptography{
public class EntlibCryptographyProvider : EverestCryptography.ICryptographyProvider
{
CryptographyManager cryptographyManager;
string hashProvider;
string symmProvider;
public EntlibCryptographyProvider(CryptographyManager cryptographyManager, string hashProvider, string symmProvider)
{
this.cryptographyManager = cryptographyManager;
this.hashProvider = hashProvider;
this.symmProvider = symmProvider;
}
#region ICryptographyProvider Members
public bool CompareHash(string plaintext, string hashedText)
{
return cryptographyManager.CompareHash(hashProvider, plaintext, hashedText);
}
public bool CompareHash(byte[] plaintext, byte[] hashedText)
{
return cryptographyManager.CompareHash(hashProvider, plaintext, hashedText);
}
public string CreateHash(string plainText)
{
return cryptographyManager.CreateHash(hashProvider, plainText);
}
public byte[] CreateHash(byte[] plaintext)
{
return cryptographyManager.CreateHash(hashProvider, plaintext);
}
public byte[] DecryptSymmetric(byte[] ciphertext)
{
return cryptographyManager.DecryptSymmetric(symmProvider, ciphertext);
}
public string DecryptSymmetric(string ciphertextBase64)
{
return cryptographyManager.DecryptSymmetric(symmProvider, ciphertextBase64);
}
public byte[] EncryptSymmetric(byte[] plaintext)
{
return cryptographyManager.EncryptSymmetric(symmProvider, plaintext);
}
public string EncryptSymmetric(string plaintext)
{
return cryptographyManager.EncryptSymmetric(symmProvider, plaintext);
}
#endregion
}
}
|