Skip to content

Commit

Permalink
Merge pull request #929 from dxdjgl/master
Browse files Browse the repository at this point in the history
Added static methods to avoid creating an object just to load from se…
  • Loading branch information
somdoron authored Aug 20, 2020
2 parents cc1a2c1 + 3e9d3e3 commit 9e4fcc5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/NetMQ/NetMQCertificate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ private NetMQCertificate(string keystr, bool isSecret)
PublicKey = key;
}

/// <summary>
/// Create a certificate from secret key, public key is derived from the secret key
/// </summary>
/// <param name="secretKey">Secret Key</param>
/// <exception cref="ArgumentException">If secret key is not 32-bytes long</exception>
/// <returns>The newly created certificate</returns>
public static NetMQCertificate CreateFromSecretKey(byte[] secretKey)
{
return new NetMQCertificate(secretKey, true);
}

/// <summary>
/// Create a certificate from secret key, public key is derived from the secret key
/// </summary>
Expand All @@ -191,6 +202,17 @@ public NetMQCertificate FromSecretKey(byte[] secretKey)
return new NetMQCertificate(secretKey, true);
}

/// <summary>
/// Create a certificate from secret key, public key is derived from the secret key
/// </summary>
/// <param name="secretKey">Secret Key</param>
/// <exception cref="ArgumentException">If secret key is not 40-chars long</exception>
/// <returns>The newly created certificate</returns>
public static NetMQCertificate CreateFromSecretKey(string secretKey)
{
return new NetMQCertificate(secretKey, true);
}

/// <summary>
/// Create a certificate from secret key, public key is derived from the secret key
/// </summary>
Expand Down

0 comments on commit 9e4fcc5

Please sign in to comment.