ExceptionExtensions.cs 661 B

1234567891011121314151617181920
  1. // Copyright (c) .NET Foundation. All rights reserved.
  2. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  3. using System;
  4. using System.Security.Cryptography;
  5. namespace Microsoft.AspNetCore.DataProtection
  6. {
  7. internal static class ExceptionExtensions
  8. {
  9. /// <summary>
  10. /// Determines whether an exception must be homogenized by being wrapped inside a
  11. /// CryptographicException before being rethrown.
  12. /// </summary>
  13. public static bool RequiresHomogenization(this Exception ex)
  14. {
  15. return !(ex is CryptographicException);
  16. }
  17. }
  18. }