Whitebox Cryptography

Whitebox cryptography is designed to protect cryptographic keys and algorithms in mobile apps from attackers who have full access to the compiled code and execution environment.

What Is Whitebox Cryptography?

White-box cryptography is a field within cryptography that focuses on protecting cryptographic algorithms and keys in scenarios where the cryptographic computations are performed in an untrusted environment. In the context of mobile apps, white box cryptography aims to prevent unauthorized access to cryptographic algorithms and keys in mobile apps by attackers who end up with complete access to the mobile app’s compiled code and the execution environment.

The Purpose of Whitebox Cryptography

The main purpose of white-box cryptography is to provide security against various forms of attacks, such as reverse engineering, code analysis, and runtime attacks, which are commonly used to extract cryptographic keys or exploit vulnerabilities in cryptographic algorithms. It is particularly relevant in situations where the cryptographic computations need to be performed in an environment that is not fully trusted, such as on an end user’s mobile device or within a cloud computing environment

White box cryptography finds applications in various domains, including software protection, secure key storage, digital rights management (DRM), financial and payment systems, software license enforcement, secure remote computations, and secure cloud computing, and mobile and embedded systems security.

In mobile apps, white-box cryptography can be used to protect sensitive data, secure cryptographic operations, and enhance the overall security of the application. Here are a few ways white-box cryptography is employed in mobile apps.

  1. Secure Storage. White box cryptography can be used to encrypt sensitive data stored by mobile apps on the device, such as user credentials, personal information, or sensitive files. By encrypting the data with white-box techniques, the encryption keys are obfuscated, making it more difficult for an attacker to extract the keys and decrypt the data.
  2. Secure Communications. Mobile apps often communicate with remote servers or other devices. White box cryptography can be utilized to secure the transmission of data over networks by encrypting the data with obfuscated encryption keys. This helps protect the confidentiality and integrity of the transmitted information, preventing eavesdropping and tampering.
  3. Secure Key Management. Mobile apps may require the use of cryptographic keys for various purposes, such as authentication, encryption, or digital signatures. White box cryptography can be used to protect these keys from extraction or misuse by obfuscating their representation within the app. This makes it harder for an attacker to extract the keys, even if they gain access to the app's code or runtime environment.
  4. Digital Rights Management (DRM). Mobile apps that involve the distribution and consumption of digital content, such as video streaming or e-book reading apps, can utilize white-box cryptography to protect the content from unauthorized access and copying. White-box techniques can be applied to encrypt and decrypt the content on the mobile device, making it difficult for attackers to extract the decryption keys.
  5. Secure Code Execution. White box cryptography can be employed to protect the execution of cryptographic algorithms within the mobile app. By obfuscating the implementation of the cryptographic algorithms and hiding the intermediate values used in the computations, white box techniques make it challenging for attackers to reverse engineer the algorithms or extract sensitive information during runtime.

By protecting the cryptographic algorithms and keys, it helps to ensure the confidentiality, integrity, and authenticity of sensitive data and computations in scenarios where the trust in the execution environment cannot be assumed.

Whitebox Cryptography vs. Traditional Cryptography

In traditional cryptography, security is achieved by keeping the cryptographic key secret, assuming that the attacker does not have access to it. In white box cryptography, however, the attacker is assumed to have full access to the compiled code and the execution environment - yet in spite of this security is maintained.

Traditional Cryptography

Traditional cryptography involves using a secret key and, typically, a standardized encryption algorithm to encrypt and decrypt data. With this approach, the control lies in maintaining the secrecy of the key: it is assumed that an attacker does not have access to the key and is unable to obtain it even through unauthorized means. Traditional cryptography is a widely-used technique, and many encryption algorithms have been developed and standardized over the years.

However, traditional cryptography has limitations when it comes to mobile apps. For example, if an attacker gains access to the mobile device, they may be able to extract the encryption key and use it to decrypt sensitive data. This is a significant risk for mobile apps that store sensitive data, such as financial or health information.

Whitebox Cryptography

Whitebox cryptography, which is a more recent approach, aims to protect cryptographic keys and algorithms from attackers who may have full access to the compiled software code and hardware environment where the encryption is executed. White-box cryptography is commonly used in mobile apps for sensitive operations such as mobile payments, digital rights management, and software licensing.

In white box cryptography, the cryptographic key and the encryption algorithm are embedded in the mobile app and secured in a way that is designed to be resistant to attacks, even when the attacker has full access to the software environment. This approach involves transforming the cryptographic algorithm and key into an opaque form that is difficult for an attacker to extract. The goal of white box cryptography is to provide secure cryptographic functionality in a hostile software environment, without relying on hardware security.

Whitebox Cryptography Complements Traditional Cryptography

While white-box cryptography provides a high level of security for sensitive data, it should not be viewed as a replacement for traditional cryptography. In many cases, traditional cryptography may still be the best option for protecting data, particularly in situations where the cryptographic keys can be adequately protected.

White box cryptography can be more computationally expensive than traditional cryptography. One reason for this is that white box cryptography often involves more complex algorithms and data structures to protect the cryptographic keys and encryption algorithms from attack. These additional layers of protection can increase the computational complexity of the encryption and decryption processes, leading to longer processing times. White-box cryptography often involves performing encryption and decryption operations. On resource-constrained devices such as mobile phones, this can further increase the computational overhead, which warrants judicious use of white box cryptography in mobile apps.

That said, while whitebox cryptography can be more computationally expensive than traditional cryptography, the increased security it provides may be worth the additional processing cost in certain mobile app scenarios where the protection of sensitive data is critical.

How Does Whitebox Cryptography Work?

In a white-box cryptography implementation, the encrypted data, the algorithm used to encrypt and decrypt the data, and the encryption key are all embedded within the mobile app. The algorithm and the keys are embedded in a way that makes it difficult for an attacker to extract the keys or reverse-engineer the algorithm, even if they have full access to the software environment.

By embedding everything within the mobile app, white box cryptography ensures that the cryptographic key is never exposed, making it difficult for an attacker to gain access to the unencrypted data. This is particularly important in a mobile app where the software environment cannot be fully trusted, and an attacker may have full access to the mobile app's code and data.

Here are the general steps involved in using whitebox cryptography in a mobile app:

  1. Choose an appropriate white-box cryptography library. There are several white-box cryptography libraries available, such as WhiteboxCrypto-AES and WhiteBox-AES. Choose a library that is well-tested and meets the security requirements of your application.
  2. Embed the cryptographic keys. White box cryptography involves embedding the cryptographic keys directly into the software code of the mobile app. This is typically done using a technique called "key whitening," which modifies the cryptographic keys in a way that makes them resistant to attack. A whitening key is generated for each instance of the mobile app, which will be combined with the cryptographic key to create a "whitened key". This can be done using a secure random number generator.
  3. Embed the encryption/decryption algorithms. The encryption and decryption algorithms used in the whitebox cryptography library need to be embedded within the mobile app. This can be done by either including the code directly in the app, or by dynamically loading the code at runtime. However, to prevent an attacker from reverse-engineering the algorithms, they are typically modified using techniques such as Boolean masking, which makes it difficult for an attacker to recover the original algorithm.
  4. Protect against attacks. To further protect against attacks, the mobile app’s code is typically obfuscated or scrambled, making it difficult for an attacker to understand or modify the code. Additionally, anti-tamper mechanisms may be included to detect and prevent unauthorized modifications to the software code. These techniques are also used to protect the whitening key and the whitened key. This helps to prevent an attacker from extracting the cryptographic key from the mobile app.
  5. Implement the encryption and decryption logic. The mobile app's encryption and decryption logic needs to be modified to use the whitened key instead of the original cryptographic key. This ensures that the data is protected even if the app is running in an untrusted environment.
  6. Verify the integrity of the code at runtime. To ensure that the white-box cryptography implementation has not been compromised, the integrity of the software code is verified at runtime using techniques such as digital signatures or checksums.

The Benefits of Whitebox Cryptography

White box cryptography provides several benefits over traditional cryptography, including:

  • Protection of cryptographic keys. In a traditional cryptography implementation, the cryptographic keys are separate from the encrypted data and while they are typically stored in a secure hardware module, they are still vulnerable to compromise. With a whitebox cryptography implementation, the cryptographic keys are embedded within the code of the mobile app, making it more difficult for an attacker to access the keys.
  • Protection against reverse-engineering. White-box cryptography modifies the encryption and decryption algorithms used to protect the data, making it difficult for an attacker to reverse-engineer the algorithm and obtain access to the unencrypted data.
  • Resilience to attacks. Whitebox cryptography implementations typically include techniques such as obfuscation, anti-tampering mechanisms, and checksum verification to protect against attacks, making it more difficult for an attacker to compromise the security of the mobile app.

Blue Cedar Implements Whitebox Cryptography

logo_icon_enforce

Blue Cedar Enforce

Blue Cedar Enforce, a component of Blue Cedar Mobile App Security, implements white-box cryptography as a way to enhance the strength of the many mobile app security features provided by Blue Cedar.

cedar_cat_no_code

Blue Cedar Enhance

Blue Cedar also provides an easy way to incorporate mobile app security into a mobile app. That is via Blue Cedar Enhance, Blue Cedar’s no-code integration service that adds new functionality to mobile apps without requiring a single line of code to be written. Blue Cedar Enhance integrates mobile app security into iOS and Android mobile app binaries, regardless of the libraries and frameworks that underpin these app binaries. 
cedar_orchestrating_2022

The Blue Cedar Platform

Blue Cedar Mobile App Security and Blue Cedar Enhance are delivered by the Blue Cedar Platform, a CI/CD friendly SaaS solution that also provides deployment services, such as app import and code signing, to streamline delivery of secured mobile apps.