public void TestCovariantSignedData()
 {
     var passBytes = Encoding.UTF8.GetBytes("TestPassword");
     var testCertificate =
         LightCertificatesHelper.GenerateSelfSignedCertificate(
             ELightCertificateSignType.Rsa,
             2048,
             ELightCertificateEncryptType.Rsa,
             2048,
             EPrivateKeysKeyDerivationFunction.ScryptDefault,
             Guid.NewGuid(),
             "TestCertificate",
             passBytes
         );
     var testB = new B()
     {
         Field1 = 1,
         Field2 = "sdasda",
         Field3 = Guid.NewGuid()
     };
     _output.WriteLine(testB.WriteObjectToJson());
     var testSignedData = new SignedData<B>(
         testB,
         testCertificate,
         passBytes
         );
     var signedData2 = testSignedData.To<A>();
     var testA = signedData2.GetValue();
     _output.WriteLine(testA.WriteObjectToJson());
 }
Beispiel #2
0
        public void TestCovariantSignedData()
        {
            var passBytes       = Encoding.UTF8.GetBytes("TestPassword");
            var testCertificate =
                LightCertificatesHelper.GenerateSelfSignedCertificate(
                    ELightCertificateSignType.Rsa,
                    2048,
                    ELightCertificateEncryptType.Rsa,
                    2048,
                    EPrivateKeysKeyDerivationFunction.ScryptDefault,
                    Guid.NewGuid(),
                    "TestCertificate",
                    passBytes
                    );
            var testB = new B()
            {
                Field1 = 1,
                Field2 = "sdasda",
                Field3 = Guid.NewGuid()
            };

            _output.WriteLine(testB.WriteObjectToJson());
            var testSignedData = new SignedData <B>(
                testB,
                testCertificate,
                passBytes
                );
            var signedData2 = testSignedData.To <A>();
            var testA       = signedData2.GetValue();

            _output.WriteLine(testA.WriteObjectToJson());
        }