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 RsaUnwrapParameterCheck(KeyWrapTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.RsaUnwrapParameterCheck", theoryData); try { var provider = new RsaKeyWrapProvider(theoryData.UnwrapKey, theoryData.UnwrapAlgorithm, true); provider.UnwrapKey(theoryData.WrappedKey); theoryData.ExpectedException.ProcessNoException(context); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context); } TestUtilities.AssertFailIfErrors(context); }
public void RsaUnwrapMismatch(KeyWrapTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.RsaUnwrapParameterCheck", theoryData); try { var encryptProvider = new RsaKeyWrapProvider(theoryData.WrapKey, theoryData.WrapAlgorithm, false); byte[] keyToWrap = Guid.NewGuid().ToByteArray(); var wrappedKey = encryptProvider.WrapKey(keyToWrap); var decryptProvider = new RsaKeyWrapProvider(theoryData.UnwrapKey, theoryData.UnwrapAlgorithm, true); byte[] unwrappedKey = decryptProvider.UnwrapKey(wrappedKey); theoryData.ExpectedException.ProcessNoException(context); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context); } TestUtilities.AssertFailIfErrors(context); }