protected override void ProcessRecord() { if (PrivateKey != null) { var keypair = PublicKeyBox.GenerateKeyPair(PrivateKey); var sKey = new SodiumKeyPair() { Info = this.Info, KeyType = "Curve25519", PrivateKey = keypair.PrivateKey.ToBase64String(), PublicKey = keypair.PublicKey.ToBase64String() }; WriteObject(sKey); } else { var keypair = PublicKeyBox.GenerateKeyPair(); var sKey = new SodiumKeyPair() { Info = this.Info, KeyType = "Curve25519", PrivateKey = keypair.PrivateKey.ToBase64String(), PublicKey = keypair.PublicKey.ToBase64String() }; WriteObject(sKey); } }
protected override void ProcessRecord() { if (Seed != null) { var keypair = PublicKeyAuth.GenerateKeyPair(Seed); //throws error if seed is not 32 bytes in length var sKey = new SodiumKeyPair() { Info = this.Info, KeyType = "Ed25519", PrivateKey = keypair.PrivateKey.ToBase64String(), PublicKey = keypair.PublicKey.ToBase64String() }; WriteObject(sKey); } else { var keypair = PublicKeyAuth.GenerateKeyPair(); var sKey = new SodiumKeyPair() { Info = this.Info, KeyType = "Ed25519", PrivateKey = keypair.PrivateKey.ToBase64String(), PublicKey = keypair.PublicKey.ToBase64String() }; WriteObject(sKey); } }