public void CreateSignatureProviderExtensibility(CryptoProviderFactoryTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.CreateSignatureProviderExtensibility", theoryData); try { theoryData.CryptoProviderFactory.CreateForSigning(theoryData.SigningKey, theoryData.SigningAlgorithm); theoryData.CryptoProviderFactory.CreateForVerifying(theoryData.VerifyKey, theoryData.VerifyAlgorithm); theoryData.ExpectedException.ProcessNoException(context); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context); } TestUtilities.AssertFailIfErrors(context); }
public void CryptoProviderFactoryConstructorParams(CryptoProviderFactoryTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.CryptoProviderFactoryConstructorParams", theoryData); try { if (theoryData.WillCreateSignatures) theoryData.CryptoProviderFactory.CreateForSigning(theoryData.SigningKey, theoryData.SigningAlgorithm); else theoryData.CryptoProviderFactory.CreateForVerifying(theoryData.SigningKey, theoryData.SigningAlgorithm); theoryData.ExpectedException.ProcessNoException(context); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context); } TestUtilities.AssertFailIfErrors(context); }
public void ReleaseRsaKeyWrapProviders(CryptoProviderFactoryTheoryData theoryData) { IdentityModelEventSource.ShowPII = true; var context = TestUtilities.WriteHeader($"{this}.ReleaseRsaKeyWrapProviders", theoryData); var cryptoProviderFactory = theoryData.CryptoProviderFactory; try { cryptoProviderFactory.ReleaseKeyWrapProvider(theoryData.RsaKeyWrapProvider); if (theoryData.CustomCryptoProvider != null && theoryData.RsaKeyWrapProvider != null && !((CustomCryptoProvider)theoryData.CustomCryptoProvider).ReleaseCalled) { context.Diffs.Add("Release wasn't called on the CustomCryptoProvider."); } theoryData.ExpectedException.ProcessNoException(context); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context); } TestUtilities.AssertFailIfErrors(context); }