Library Moduleswift-crypto 3.12.2Crypto

Crypto

A cryptography library for Swift.

index.md
import Crypto

Module information

Declarations
478
Symbols
883

Coverage

95.6 percent of the declarations in Crypto are fully documented4.4 percent of the declarations in Crypto are indirectly documented

Declarations

0.6 percent of the declarations in Crypto are operators39.5 percent of the declarations in Crypto are initializers, type members, or enum cases34.7 percent of the declarations in Crypto are instance members2.1 percent of the declarations in Crypto are protocols4.0 percent of the declarations in Crypto are protocol requirements1.7 percent of the declarations in Crypto are default implementations14.4 percent of the declarations in Crypto are structures2.9 percent of the declarations in Crypto are typealiases

Interfaces

100.0 percent of the declarations in Crypto are unrestricted
Module stats and coverage details

Overview

Swift Crypto provides a Swift library for common cryptographic operations. It is available as a Swift package and provides two main libraries:

  • Crypto - an open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms. It enables cross-platform or server applications with the advantages of CryptoKit.

  • CryptoExtras - a collection of additional cryptographic primitives and utilities that are not part of CryptoKit but useful in a server environment.

Swift Crypto is built on top of BoringSSL, Google’s fork of OpenSSL. The current features of Swift Crypto cover key exchange, key derivation, encryption and decryption, hashing, message authentication, and more.

Cryptographically secure hashes

  • protocol HashFunction

    A type that performs cryptographically secure hashing.

  • struct SHA512

    An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 512-bit digest.

  • struct SHA384

    An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 384-bit digest.

  • struct SHA256

    An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 256-bit digest.

Message authentication codes

Ciphers

  • enum AES

    A container for Advanced Encryption Standard (AES) ciphers.

  • enum ChaChaPoly

    An implementation of the ChaCha20-Poly1305 cipher.

Public key cryptography

  • enum Curve25519

    An elliptic curve that enables X25519 key agreement and Ed25519 signatures.

  • enum P521

    An elliptic curve that enables NIST P-521 signatures and key agreement.

  • enum P384

    An elliptic curve that enables NIST P-384 signatures and key agreement.

  • enum P256

    An elliptic curve that enables NIST P-256 signatures and key agreement.

  • struct SharedSecret

    A key agreement result from which you can derive a symmetric cryptographic key.

  • enum HPKE

    A container for hybrid public key encryption (HPKE) operations.

Key derivation functions

  • struct HKDF<H>

    A standards-based implementation of an HMAC-based Key Derivation Function (HKDF).

Errors

Legacy algorithms

  • enum Insecure

    A container for older, cryptographically insecure algorithms.