コード例 #1
0
ファイル: X25519.cs プロジェクト: jimsch/cose-implementations
        static public void SelfTest()
        {
            BigInteger privateKey = new BigInteger("9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60", 16);

            byte[]     message0 = new byte[0];
            EdDSA25517 x        = new EdDSA25517();

            EdDSAPoint publicKey = x.GetPublic(privateKey.ToByteArrayUnsigned());

            publicKey = (EdDSAPoint25517)publicKey.Normalize();
            byte[]     rgbPublicKey = publicKey.Encode();
            EdDSAPoint pt2          = x.DecodePoint(rgbPublicKey);


            byte[] signature = x.Sign(rgbPublicKey, privateKey.ToByteArrayUnsigned(), message0);

            x.Verify(rgbPublicKey, message0, signature);
        }
コード例 #2
0
ファイル: X25519.cs プロジェクト: jimsch/cose-implementations
        public static void SelfTest()
        {
            BigInteger secretkey = new BigInteger("6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b", 16);
            BigInteger publicKey = new BigInteger("b3da079b0aa493a5772029f0467baebee5a8112d9d3a22532361da294f7bb3815c5dc59e176b4d9f381ca0938e13c6c07b174be65dfa578e80", 16);

            //byte[] rgbMessage = new byte[] { 0x64, 0xa6, 0x5f, 0x3c, 0xde, 0xdc, 0xdd, 0x66, 0x81, 0x1e, 0x29, 0x15, 0xe7 };
            byte[]   rgbMessage = new byte[0];
            EdDSA448 x          = new EdDSA448();

            BigInteger signature = new BigInteger("6a12066f55331b6c22acd5d5bfc5d71228fbda80ae8dec26bdd306743c5027cb4890810c162c027468675ecf645a83176c0d7323a2ccde2d80efe5a1268e8aca1d6fbc194d3f77c44986eb4ab4177919ad8bec33eb47bbb5fc6e28196fd1caf56b4e7e0ba5519234d047155ac727a1053100", 16);

            EdDSAPoint publicPoint = x.GetPublic(secretkey.ToByteArrayUnsigned());

            byte[] rgbPublic = publicPoint.Normalize().Encode();

            byte[] rgbSig = x.Sign(rgbPublic, secretkey.ToByteArrayUnsigned(), rgbMessage);

            EdDSAPoint decodePoint = x.DecodePoint(rgbPublic);

            x.Verify(rgbPublic, rgbMessage, rgbSig);
        }