コード例 #1
0
ファイル: ECJwkTests.cs プロジェクト: uruk-project/Jwt
        public void Equal(EllipticalCurve crv)
        {
            var key = ECJwk.GeneratePrivateKey(crv);

            Assert.True(key.Equals(key));
            Assert.Equal(key, key);
            var publicKey = key.AsPublicKey();

            Assert.NotEqual(key, publicKey);
            var copiedKey = ECJwk.FromJson(key.ToString());

            Assert.Equal(key, copiedKey);

            // 'kid' is not a discriminant, excepted if the value is different.
            copiedKey.Kid = default;
            Assert.Equal(key, copiedKey);
            Assert.Equal(copiedKey, key);
            key.Kid = default;
            Assert.Equal(key, copiedKey);
            key.Kid       = JsonEncodedText.Encode("X");
            copiedKey.Kid = JsonEncodedText.Encode("Y");
            Assert.NotEqual(key, copiedKey);

            Assert.NotEqual(key, Jwk.None);
        }