public void ExtractEd25519SeedFromEd25519SecretKeyTest()
        {
            var kp1  = PublicKeyAuth.GenerateKeyPair();
            var seed = PublicKeyAuth.ExtractEd25519SeedFromEd25519SecretKey(kp1.Secret);
            var kp2  = PublicKeyAuth.GenerateKeyPair(seed);

            Assert.AreEqual(Convert.ToBase64String(kp1.Public), Convert.ToBase64String(kp2.Public));
            Assert.AreEqual(Convert.ToBase64String(kp1.Secret), Convert.ToBase64String(kp2.Secret));
        }
示例#2
0
        public void ExtractEd25519SeedFromEd25519SecretKeyTest()
        {
            // generate an Ed25519 keypair
            var firstKeypair = PublicKeyAuth.GenerateKeyPair();
            // extract the seed from the generated keypair
            var seed = PublicKeyAuth.ExtractEd25519SeedFromEd25519SecretKey(firstKeypair.PrivateKey);
            // generate a second keypair from the seed
            var secondKeyPair = PublicKeyAuth.GenerateKeyPair(seed);

            CollectionAssert.AreEqual(firstKeypair.PublicKey, secondKeyPair.PublicKey);
            CollectionAssert.AreEqual(firstKeypair.PrivateKey, secondKeyPair.PrivateKey);
        }