/// <summary> /// Generate a new KeyPair /// </summary> public KeyPair() { var sodiumKeyPair = Sodium.PublicKeyBox.GenerateKeyPair(); Secret = new PrivateSecretKey(sodiumKeyPair.PrivateKey); Public = new PublicKey(sodiumKeyPair.PublicKey); }
/// <summary> /// Generate a new KeyPair /// </summary> public SigningKeyPair() { var sodiumKeyPair = Sodium.PublicKeyAuth.GenerateKeyPair(); Secret = new PrivateSecretKey(sodiumKeyPair.PrivateKey); Public = new PublicKey(sodiumKeyPair.PublicKey); }
/// <summary> /// Generate a KeyPair from a given Private Key /// </summary> /// <param name="privKey">Secret Private Key</param> public KeyPair(IPrivateSecretKey privKey) { if (privKey == null) { throw new ArgumentNullException(nameof(privKey)); } var sodiumKeyPair = Sodium.PublicKeyBox.GenerateKeyPair(privKey.Bytes); Secret = new PrivateSecretKey(sodiumKeyPair.PrivateKey); Public = new PublicKey(sodiumKeyPair.PublicKey); }