コード例 #1
0
        public void SetOption_CurveSecretKey()
        {
            if (!ZContext.Has("curve"))
            {
                Assert.Ignore("Ignored due to missing curve support");
            }
            Assume.That(PlatformKind.Win32 == Platform.Kind); // TODO: fix the test and remove this

            DoWithUnconnectedPairSocket(socket =>
            {
                // TODO: the interface is confusing; Z85-encoded keys should always be strings
                byte[] publicKeyZ85, secretKeyZ85;
                Z85.CurveKeypair(out publicKeyZ85, out secretKeyZ85);
                socket.CurveSecretKey  = secretKeyZ85;
                byte[] secretKeyBinary = Z85.Decode(secretKeyZ85);
                CollectionAssert.AreEqual(secretKeyBinary, socket.CurveSecretKey);
            });
        }