public void Version2SignatureNullSecretFails() { // Arrange var paseto = new Version2(); // Act & Assert Assert.Throws <ArgumentNullException>(() => paseto.Sign(null, HelloPaseto)); }
public void Version2SignatureEmptySecretFails() { // Arrange var paseto = new Version2(); // Act & Assert Assert.Throws <ArgumentException>(() => paseto.Sign(new byte[0], HelloPaseto)); }
public void Version2SignatureEmptyPayloadFails() { // Arrange var paseto = new Version2(); Ed25519.KeyPairFromSeed(out var pk, out var sk, new byte[32]); // Act & Assert Assert.Throws <ArgumentNullException>(() => paseto.Sign(sk, string.Empty)); }
public void Version2SignatureTest() { // Arrange var paseto = new Version2(); var seed = new byte[32]; Ed25519.KeyPairFromSeed(out var pk, out var sk, seed); // Act var signature = paseto.Sign(sk, HelloPaseto); // Assert Assert.IsNotNull(signature); }
public void Version2SignatureVerificationTest() { // Arrange var paseto = new Version2(); var seed = new byte[32]; RandomNumberGenerator.Create().GetBytes(seed); Ed25519.KeyPairFromSeed(out var pk, out var sk, seed); //var pub = Convert.ToBase64String(pk); // Act var token = paseto.Sign(sk, HelloPaseto); var verified = paseto.Verify(token, pk).Valid; // Assert Assert.IsTrue(verified); }