SwiftBindings.Apple.CryptoKit
26.2.6
dotnet add package SwiftBindings.Apple.CryptoKit --version 26.2.6
NuGet\Install-Package SwiftBindings.Apple.CryptoKit -Version 26.2.6
<PackageReference Include="SwiftBindings.Apple.CryptoKit" Version="26.2.6" />
<PackageVersion Include="SwiftBindings.Apple.CryptoKit" Version="26.2.6" />
<PackageReference Include="SwiftBindings.Apple.CryptoKit" />
paket add SwiftBindings.Apple.CryptoKit --version 26.2.6
#r "nuget: SwiftBindings.Apple.CryptoKit, 26.2.6"
#:package SwiftBindings.Apple.CryptoKit@26.2.6
#addin nuget:?package=SwiftBindings.Apple.CryptoKit&version=26.2.6
#tool nuget:?package=SwiftBindings.Apple.CryptoKit&version=26.2.6
SwiftBindings.Apple.CryptoKit
Native .NET bindings for Apple's CryptoKit framework — hashing, symmetric and authenticated encryption, key agreement, and signatures. These are not Objective-C proxy wrappers; they use .NET 10's native Swift interop for direct, high-performance calls into Swift APIs from C#.
📖 Full usage guide → — Swift→C# naming, authenticated encryption (AES-GCM/ChaChaPoly), hashing, HMAC, key agreement, ECDSA signatures, and the generic-overload caveats that decide which APIs are callable.
Installation
dotnet add package SwiftBindings.Apple.CryptoKit
Requirements
- .NET 10.0+
- iOS 26.2+, macOS 26.2+, Mac Catalyst 26.2+, tvOS 26.2+
- macOS host for development
Usage
Hashing
using System.Text;
using CryptoKit;
var data = Encoding.UTF8.GetBytes("hello");
var digest = SHA256.Hash(data);
Authenticated encryption (AES-GCM)
using System.Text;
using CryptoKit;
var key = new SymmetricKey(SymmetricKeySize.Bits256);
var plaintext = Encoding.UTF8.GetBytes("secret message");
var sealedBox = AES.GCM.Seal(plaintext, key);
var recovered = AES.GCM.Open(sealedBox, key);
ChaChaPoly
var key = new SymmetricKey(SymmetricKeySize.Bits256);
var sealedBox = ChaChaPoly.Seal(plaintext, key);
var recovered = ChaChaPoly.Open(sealedBox, key);
Authenticated encryption with associated data
var aad = Encoding.UTF8.GetBytes("authenticated-header");
var sealedBox = AES.GCM.Seal(plaintext, key, aad);
// sealedBox.Ciphertext / sealedBox.Tag are exposed as byte[]
Documentation
- Usage guide (wiki) — full C# walkthrough of the binding surface
- Apple CryptoKit framework
Caveats
The primary AEAD round-trip (AES.GCM and ChaChaPoly Seal/Open) is verified end-to-end on both Mono JIT (simulator) and NativeAOT (device).
A residual cluster of ancillary CryptoKit APIs are emitted as [Obsolete("SB0001")] stubs and are not callable from C# in this release:
- HMAC constructor
- Signature generation (P-256/P-384/P-521 ECDSA
signature(for:)) - HPKE
Unwrap/Decapsulate/ExportSecret AES.GCM.Open<TAD>(the generic overload that takes authenticated-data of an arbitraryDataProtocoltype)- The 3-argument
IsValidSignature(_:for:)overload
Tamper detection is exercised via wrong-key Open (which throws authenticationFailure) rather than the SealedBox(nonce:ciphertext:tag:) constructor (a Swift generic init the binding generator does not yet emit).
How It Works
These bindings are auto-generated by Swift Dotnet Bindings using .NET 10's native Swift interop via the SwiftBindings SDK.
License
The bindings are MIT licensed. CryptoKit is part of the Apple SDK; refer to Apple's licensing for the underlying framework.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-ios26.2 is compatible. net10.0-maccatalyst26.2 is compatible. net10.0-macos26.2 is compatible. net10.0-tvos26.2 is compatible. |
-
net10.0-ios26.2
- SwiftBindings.Apple (>= 26.2.6)
- SwiftBindings.Runtime (>= 0.14.0 && < 0.15.0)
-
net10.0-maccatalyst26.2
- SwiftBindings.Apple (>= 26.2.6)
- SwiftBindings.Runtime (>= 0.14.0 && < 0.15.0)
-
net10.0-macos26.2
- SwiftBindings.Apple (>= 26.2.6)
- SwiftBindings.Runtime (>= 0.14.0 && < 0.15.0)
-
net10.0-tvos26.2
- SwiftBindings.Apple (>= 26.2.6)
- SwiftBindings.Runtime (>= 0.14.0 && < 0.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.