Example #1
0
 public void RsaUnwrapTamperedData(RsaKeyWrapTestParams theoryParams)
 {
     try
     {
         theoryParams.Provider.UnwrapKey(theoryParams.WrappedKey);
         theoryParams.EE.ProcessNoException();
     }
     catch (Exception ex)
     {
         theoryParams.EE.ProcessException(ex);
     }
 }
Example #2
0
        public void RsaUnwrapParameterCheck(RsaKeyWrapTestParams theoryParams)
        {
            try
            {
                var provider = new RsaKeyWrapProvider(theoryParams.DecryptKey, theoryParams.DecryptAlgorithm, true);
                provider.UnwrapKey(theoryParams.WrappedKey);

                theoryParams.EE.ProcessNoException();
            }
            catch (Exception ex)
            {
                theoryParams.EE.ProcessException(ex);
            }
        }
Example #3
0
 public void RsaUnwrapMismatch(RsaKeyWrapTestParams theoryParams)
 {
     try
     {
         var    encryptProvider = new RsaKeyWrapProvider(theoryParams.EncryptKey, theoryParams.EncryptAlgorithm, false);
         byte[] keyToWrap       = Guid.NewGuid().ToByteArray();
         var    wrappedKey      = encryptProvider.WrapKey(keyToWrap);
         var    decryptProvider = new RsaKeyWrapProvider(theoryParams.DecryptKey, theoryParams.DecryptAlgorithm, true);
         byte[] unwrappedKey    = decryptProvider.UnwrapKey(wrappedKey);
         theoryParams.EE.ProcessNoException();
     }
     catch (Exception ex)
     {
         theoryParams.EE.ProcessException(ex);
     }
 }
Example #4
0
        public void RsaWrapUnwrapKey(RsaKeyWrapTestParams theoryParams)
        {
            try
            {
                var    encryptProvider = new RsaKeyWrapProvider(theoryParams.EncryptKey, theoryParams.EncryptAlgorithm, false);
                var    wrappedKey      = encryptProvider.WrapKey(theoryParams.KeyToWrap);
                var    decryptProvider = new DerivedRsaKeyWrapProvider(theoryParams.DecryptKey, theoryParams.DecryptAlgorithm, true);
                byte[] unwrappedKey    = decryptProvider.UnwrapKey(wrappedKey);

                Assert.True(Utility.AreEqual(unwrappedKey, theoryParams.KeyToWrap), "theoryParams.KeyToWrap != unwrappedKey");

                theoryParams.EE.ProcessNoException();
            }
            catch (Exception ex)
            {
                theoryParams.EE.ProcessException(ex);
            }
        }