CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

WhiteboxCryptography 1.0.7

WhiteboxCryptography 1.0.7

Maintained by Sanjay Dey.



  • By
  • Sanjay Dey


<html
lang="en"

data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"
data-a11y-animated-images="system" data-a11y-link-underlines="true"








<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-953961b66e63.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c2a395868004.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-2f00718c6733.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-2bd3a44faeb2.css" />




WhiteboxCryptography/README.md at develop · DrDijkstra/WhiteboxCryptography · GitHub



<meta name="hovercard-subject-tag" content="repository:901461850" data-turbo-transient>


<meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">

<meta name="user-login" content="">



<meta name="viewport" content="width=device-width">



  <meta name="description" content="WhiteboxCryptographySDK. Contribute to DrDijkstra/WhiteboxCryptography development by creating an account on GitHub.">

  <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">

<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/DrDijkstra/WhiteboxCryptography/blob/develop/README.md" />

  <meta name="twitter:image" content="https://opengraph.githubassets.com/e28b311e7c81039b7c1c040e804ce34b1c473b8359684ed40c96cb8136a41f6e/DrDijkstra/WhiteboxCryptography" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="WhiteboxCryptography/README.md at develop · DrDijkstra/WhiteboxCryptography" /><meta name="twitter:description" content="WhiteboxCryptographySDK. Contribute to DrDijkstra/WhiteboxCryptography development by creating an account on GitHub." />

  <meta name="hostname" content="github.com">



    <meta name="expected-hostname" content="github.com">




  <meta name="turbo-cache-control" content="no-cache" data-turbo-transient>

<meta data-hydrostats="publish">

<meta name="turbo-body-classes" content="logged-out env-production page-responsive">





<div class="position-relative header-wrapper js-header-wrapper ">
  <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a>

  <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">
<span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span>

  <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_ui-commands_ui-commands_ts-ad1e2d0f65cc.js"></script>

<react-partial
partial-name="keyboard-shortcuts-dialog"
data-ssr="false"
data-attempted-ssr="false"

  <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full">

    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
<path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>




<button id="icon-button-a815e3cb-4e9e-4e81-a8f7-027fa4035691" aria-labelledby="tooltip-8e7649c0-95c0-43ba-8247-a6687eae6c3e" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close">  <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>


Dismiss alert


<div id="js-flash-container" class="flash-container" data-turbo-replace>


Latest commit

 

History

History
155 lines (101 loc) · 6.11 KB

README.md

File metadata and controls

155 lines (101 loc) · 6.11 KB

White Box Cryptography Logo

White Box Cryptography Framework

Swift Platforms CocoaPods Compatible Carthage Compatible Swift Package Manager

A high-performance White Box Cryptography (WBC) framework designed to secure cryptographic keys and operations in a way that prevents attackers from extracting or reverse-engineering them, even when the code and memory are fully exposed. This framework implements cryptographic algorithms in a manner that resists various side-channel and reverse-engineering attacks.

Features

  • Secure Key Management: Protects cryptographic keys from extraction or analysis.
  • Encryption Algorithms: Provides implementations for a variety of cryptographic algorithms in a white-box secure fashion.
  • Side-Channel Attack Resistance: Built with techniques that prevent leaking sensitive data during execution.
  • Cross-Platform Support: Compatible with iOS and macOS applications.
  • Optimized Performance: Designed to provide a balance between security and efficiency.

Installation

Using Swift Package Manager (SPM)

To integrate the White Box Cryptography framework into your Xcode project using Swift Package Manager, follow these steps:

  1. Open your Xcode project.
  2. Go to File > Swift Packages > Add Package Dependency.
  3. Enter the repository URL for this framework: https://github.com/DrDijkstra/WhiteboxCryptography.
  4. Choose the version range or tag for the release you want to use.

Using CocoaPods

  1. Add the following to your Podfile:
 pod 'WhiteboxCryptographySDK', '~> 1.0'
  1. Run pod install in the terminal.

  2. Open the .xcworkspace file in Xcode.

Using Carthage

To integrate White Box Cryptography with Carthage, add the following to your Cartfile:

github "DrDijkstra/WhiteboxCryptography" ~> 1.0.1

Then run carthage update to build the framework.

Usage

To use the White Box Cryptography framework in your project, follow the appropriate instructions based on your package manager:

For Swift Package Manager (SPM)

Simply import the framework into your Swift files:

import WhiteBoxCryptography

For Carthage or CocoaPods

Import the framework using the following:

import WhiteboxCryptographySDK

Notes:

  • Ensure the framework is properly integrated into your project according to the package manager's setup instructions.
  • Double-check the capitalization of WhiteBoxCryptography and WhiteboxCryptographySDK as some environments may be case-sensitive.

Example Usage of WhiteboxCryptographySDK

// Example of how to use the encryption and decryption functionalities

import Foundation

// Initialize the WhiteboxCryptographySDK with a memory key
let memoryKey = "your-memory-key".data(using: .utf8)!
let whiteboxSDK = WhiteboxCryptographySDK(memoryKey: memoryKey)

// Sample data to encrypt
let data = "Sensitive data".data(using: .utf8)!

// Define a cryptographic key and IV
let encryptionKey = "your-encryption-key".data(using: .utf8)!
let iv = "your-iv-string".data(using: .utf8) // Optional IV for block ciphers
let algorithm: CryptoAlgorithm = .aes // Replace with the actual algorithm

// Encrypt the data
if let encryptedData = whiteboxSDK.encrypt(data: data, withKey: encryptionKey, iv: iv, algorithm: algorithm) {
    print("Encrypted Data: \(encryptedData.base64EncodedString())")

    // Decrypt the data
    if let decryptedData = whiteboxSDK.decrypt(data: encryptedData, withKey: encryptionKey, iv: iv, algorithm: algorithm) {
        let decryptedString = String(data: decryptedData, encoding: .utf8)
        print("Decrypted String: \(decryptedString ?? "Failed to decrypt")")
    } else {
        print("Decryption failed")
    }
} else {
    print("Encryption failed")
}

Available Cryptographic Algorithms

The following cryptographic algorithms are available in this implementation:

  • AES (Advanced Encryption Standard): A symmetric key encryption standard used for securing data.

    • Supports different key sizes (AESKeySize) and modes of operation (AESMode).
  • DES (Data Encryption Standard): A symmetric-key block cipher, formerly a widely-used method of data encryption.

  • Triple DES (3DES): An enhancement of DES that applies the DES algorithm three times to each data block.

  • CAST: A family of symmetric-key block ciphers designed for strong encryption.

  • RC2 (Ron's Code 2): A block cipher designed for use in hardware or software environments, often used for file encryption.

The framework supports encryption, decryption, and hashing for these algorithms in a white-box cryptographic fashion.

License

This framework is licensed under the MIT License. See the LICENSE file for more details.

Contributing

We welcome contributions to improve the framework! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Create a pull request.

Contact

For questions or support, please contact us at:
Email: [email protected]
GitHub: https://github.com/DrDijkstra/WhiteboxCryptography

<template id="site-details-dialog">



</div>

<div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div>
<div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div>