Skip to content

Interop+AppleCrypto+AppleCFErrorCryptographicException: The operation couldn't be completed. (OSStatus error -25293 - CSSM Exception: -2147416032 CSSMERR_CSP_OPERATION_AUTH_DENIED) #52766

Closed as not planned

Description

@DanRigby

I recent ran into the exception Interop+AppleCrypto+AppleCFErrorCryptographicException: The operation couldn't be completed. (OSStatus error -25293 - CSSM Exception: -2147416032 CSSMERR_CSP_OPERATION_AUTH_DENIED) and silent process crashing issues with a set of unit tests dealing with cryptography for a .NET Core project we are porting to .NET 5.

Short version:

macOS had decided dotnet was invalidly signed and was suppressing all keychain prompts. Uninstalling and reinstalling the dotnet sdk resolved the issue.

Long version:

Our project tooling scripts download a local copy of the dotnet sdk and uses that for building/packaging/etc of the project. When SDK version 5.0.203 was released, we updated the tooling the same day to start pulling in the new version. Around that time I started seeing failures in some local unit tests that dealt with cryptography.

They either silent failed due to the test process crashing:

Starting test execution, please wait...
Logging Vstest Diagnostics in file: /Users/dan/Projects/<removed>
A total of 1 test files matched the specified pattern.
The active test run was aborted. Reason: Test host process crashed
Test Run Aborted.

Or two were throwing a very specific exception:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed <removed>_EncryptAndDecrypt [137 ms]
  Error Message:
   Test method <removed>_EncryptAndDecrypt threw exception:
Interop+AppleCrypto+AppleCFErrorCryptographicException: The operation couldn’t be completed. (OSStatus error -25293 - CSSM Exception: -2147416032 CSSMERR_CSP_OPERATION_AUTH_DENIED)
  Stack Trace:
      at Interop.AppleCrypto.ProcessPrimitiveResponse(Int32 returnValue, SafeCFDataHandle cfData, SafeCFErrorHandle cfError, Span`1 destination, Int32& bytesWritten)
   at Interop.AppleCrypto.TryRsaDecryptionPrimitive(SafeSecKeyRefHandle privateKey, ReadOnlySpan`1 source, Span`1 destination, Int32& bytesWritten)
   at System.Security.Cryptography.RSAImplementation.RSASecurityTransforms.TryDecrypt(SafeSecKeyRefHandle privateKey, ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten)
   at System.Security.Cryptography.RSAImplementation.RSASecurityTransforms.Decrypt(Byte[] data, RSAEncryptionPadding padding)

Researching the error CSSMERR_CSP_OPERATION_AUTH_DENIED eventually led me to look the macOS console:

console

Which revealed that macOS was suppressing keychain prompt for invalidly signed client /Users/dan/Projects/<removed>/.dotnet/dotnet.

At this point I deleted the local copy of dotnet and let the tooling download a fresh copy. Afterwards the unit tests started passing again and the test process crashes stopped.

Feedback:

  • If some of the tests hadn't been throwing a specific unique exception, I'm not sure how I would have resolved this. I did find this github issue Mac OS X .net core 3.1.1 Self Signed RSA Certificate Interop+AppleCrypto+AppleCFErrorCryptographicException #37522, but the fix was that the user updated their version of dotnet (we were already using the latest).

  • For the tests that were crashing, there was no exception or error code information reported. I attempted to use dotnet test --blame-crash but this is only available on Windows currently. Support for dotnet test --blame-crash for non windows platforms would be really helpful, especially in platform specific cases like this.

Thanks! /cc @vcsjones who suggested I open this issue.

Activity

  1. ghost added
    untriaged
    on May 14, 2021
  2. vcsjones commented on May 14, 2021

    @vcsjones
    Member

    Note: I asked @DanRigby to post an issue here. while the immediate issue has been resolved, there might be room to improve when folks get in to this situation on MacOS. It's rather tricky to diagnose. This could be a better exception or documentation.

  3. removed
    untriaged
    on Jul 2, 2021
  4. added this to the Future milestone on Jul 2, 2021
  5. dotnet-policy-service commented on Jan 2, 2026

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

    This process is part of our issue cleanup automation.

  6. added
    backlog-cleanup-candidate
    and removed
    backlog-cleanup-candidate
    on Jan 2, 2026
  7. vcsjones commented on Jun 19, 2026

    @vcsjones
    Member

    Closing per above, there haven't been other reports of this to my knowledge. If this is still a problem please feel free to re-open the issue or file a new issue.

  8. locked and limited conversation to collaborators on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions