1 Star 0 Fork 19

dragPhoenix/Vive.Crypto

forked from Stoneson/Vive.Crypto 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
AsymmetricProviderFactory.cs 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Stoneson 提交于 2020-05-24 13:00 . update
using System;
using System.Collections.Generic;
using System.Text;
using Vive.Crypto.Core.Internals.Extensions;
namespace Vive.Crypto
{
/// <summary>
/// 非对称加密类型
/// </summary>
public enum AsymmetricProviderType
{
RSA = 1,
RSA2 = 2,
SM2 = 3,
}
//=====================================================================================================================================================
/// <summary>
/// 非对称加密工厂类
/// </summary>
internal sealed class AsymmetricProviderFactory
{
public static IAsymmetricProvider Create(string providerTypestr = "RSA")
{
var providerType = providerTypestr.ToEnum<AsymmetricProviderType>();
return Create(providerType);
}
public static IAsymmetricProvider Create(AsymmetricProviderType providerType = AsymmetricProviderType.RSA)
{
switch (providerType)
{
case AsymmetricProviderType.RSA:
return new RSAEncryption();
case AsymmetricProviderType.RSA2:
return new RSA2Encryption();
case AsymmetricProviderType.SM2:
return new SM2Encryption();
default:
return new RSAEncryption();
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/dragPhoenix/Vive.Crypto.git
git@gitee.com:dragPhoenix/Vive.Crypto.git
dragPhoenix
Vive.Crypto
Vive.Crypto
master

搜索帮助