You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
//-----------------------------------------------------------------------
|
|
// <copyright file="EncryptionFactory.cs" company="Origtek">
|
|
// EncryptionFactory belongs to Copyright (c) Origtek. All rights reserved.
|
|
// </copyright>
|
|
//-----------------------------------------------------------------------
|
|
|
|
namespace OT.COM.Encryption
|
|
{
|
|
using OT.COM.LogisticsUtil;
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Encryption Factory
|
|
/// </summary>
|
|
public partial class EncryptionFactory
|
|
{
|
|
/// <summary>
|
|
/// For choose encryption type
|
|
/// </summary>
|
|
public enum EncryptionType
|
|
{
|
|
/// <summary>
|
|
/// AES algorithm
|
|
/// </summary>
|
|
ET_AES = 0,
|
|
|
|
/// <summary>
|
|
/// DES algorithm
|
|
/// </summary>
|
|
ET_DES = 1,
|
|
|
|
/// <summary>
|
|
/// Triple DES algorithm
|
|
/// </summary>
|
|
ET_TripleDES = 2
|
|
}
|
|
|
|
/// <summary>
|
|
/// Factory entry
|
|
/// </summary>
|
|
/// <param name="i_et">
|
|
/// Encryption type
|
|
/// </param>
|
|
/// <returns>
|
|
/// Created AEncryption object
|
|
/// </returns>
|
|
public AEncryption GetInstance(EncryptionType i_et)
|
|
{
|
|
string sName = Enum.GetName(typeof(EncryptionType), i_et);
|
|
|
|
object oRes = null;
|
|
|
|
ClassHelper.GetInstByClassName(sName.Substring(3), out oRes);
|
|
|
|
return (oRes == null) ? null : oRes as AEncryption;
|
|
}
|
|
}
|
|
}
|