/// <summary> /// Load Key pcks7 pem /// </summary> /// <param name="privateKey"></param> public void LoadKey(string privateKey) { if (privateKey == null) { throw new ArgumentNullException("privateKey"); } this.keys = OpenSslKey.DecodeOpenSSLPrivateKey(privateKey); }
private byte[] Sign(byte[] data) { using (var rsa = OpenSslKey.DecodeRSAPrivateKey(this.keys)) { byte[] signature = rsa.SignData(data, this.GetAlgorithmName()); return(signature); } }
/// <summary> /// Load Key File pcks7 pem /// </summary> /// <param name="filepath"></param> public void LoadKeyFile(string filepath) { if (filepath == null) { throw new ArgumentNullException("filepath"); } var privateKey = File.ReadAllText(filepath); this.keys = OpenSslKey.DecodeOpenSSLPrivateKey(privateKey); }