49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using Ease.NetCore.Utility;
|
|
|
|
namespace OnlineSalesAutoCrop.RMQ.Consumer
|
|
{
|
|
public static class HeplerFunctions
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="base64String"></param>
|
|
/// <returns></returns>
|
|
public static string ConvertFromBase64String(string base64String)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(base64String);
|
|
if (string.IsNullOrEmpty(base64String))
|
|
return string.Empty;
|
|
|
|
byte[] data = Convert.FromBase64String(base64String);
|
|
return System.Text.Encoding.UTF8.GetString(data);
|
|
}
|
|
}
|
|
|
|
public class AppSettings
|
|
{
|
|
public string PwdSecretKey { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Rabbit MQ Information
|
|
/// </summary>
|
|
public string RabbitMQHost { get; set; } = "localhost";
|
|
public string RabbitMQUser { get; set; } = "guest";
|
|
|
|
private string _rabbitMQPwd = "";
|
|
public string RabbitMQPwd
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(_rabbitMQPwd) || string.IsNullOrEmpty(PwdSecretKey))
|
|
return string.Empty;
|
|
|
|
string secretKey = HeplerFunctions.ConvertFromBase64String(PwdSecretKey);
|
|
return Global.CipherFunctions.DecryptByAES(privateKey: secretKey, publicKey: secretKey, data: _rabbitMQPwd, input: 2);
|
|
}
|
|
set { _rabbitMQPwd = value; }
|
|
}
|
|
public int RabbitMQPort { get; set; }
|
|
}
|
|
}
|