public CertificatesIssuer(IVaultClient client, VaultOptions options) { _client = client; _options = options.Pki; _mountPoint = string.IsNullOrWhiteSpace(_options.MountPoint) ? SecretsEngineDefaultPaths.PKI : _options.MountPoint; _certificateFormat = string.IsNullOrWhiteSpace(_options.CertificateFormat) ? CertificateFormat.pem : Enum.Parse <CertificateFormat>(_options.CertificateFormat, true); _privateKeyFormat = string.IsNullOrWhiteSpace(_options.PrivateKeyFormat) ? PrivateKeyFormat.der : Enum.Parse <PrivateKeyFormat>(_options.PrivateKeyFormat, true); }
public static XResult <String> MakeSign(Object instance, String privateKey, PrivateKeyFormat privateKeyFormat, String signType = "RSA2") { var properties = from p in instance.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty) where String.Compare(p.Name, "sign", true) != 0 select p; var dic = new Dictionary <String, String>(properties.Count()); foreach (var p in properties) { var cusAttr = p.GetCustomAttribute <JsonPropertyAttribute>(); var propertyValue = p.XGetValue(instance); if (propertyValue != null) { dic[cusAttr != null ? cusAttr.PropertyName : p.Name.ToLower()] = propertyValue.ToString(); } } return(MakeSign(dic, privateKey, privateKeyFormat, signType)); }
public static XResult <Byte[]> MakeSign(Byte[] signContent, String privateKey, PrivateKeyFormat privateKeyFormat, String signType = "RSA2") { return(CryptoHelper.MakeSign(signContent, privateKey, privateKeyFormat, GetHasAlgName(signType))); }
public static XResult <String> MakeSign(IDictionary <String, String> paraDic, String privateKey, PrivateKeyFormat privateKeyFormat, String signType = "RSA2") { if (paraDic == null || paraDic.Count == 0) { return(new XResult <String>(null, new ArgumentNullException("paraDic is null"))); } if (String.IsNullOrWhiteSpace(privateKey)) { return(new XResult <String>(null, new ArgumentNullException("privateKey is null"))); } return(CryptoHelper.MakeSign(GetSignContent(paraDic), privateKey, privateKeyFormat, GetHasAlgName(signType))); }