public void RsaUnwrapTamperedData(RsaKeyWrapTestParams theoryParams) { try { theoryParams.Provider.UnwrapKey(theoryParams.WrappedKey); theoryParams.EE.ProcessNoException(); } catch (Exception ex) { theoryParams.EE.ProcessException(ex); } }
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); } }
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); } }
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); } }