Bouncy Castle (cryptography)

Last updated

Bouncy Castle
Developer(s) Legion of the Bouncy Castle Inc.
Stable release(s) [±]
Java1.77 / November 13, 2023;3 months ago (2023-11-13) [1]
Java LTSBC-LJA 2.73.4 / January 22, 2024;48 days ago (2024-01-22) [2]
Java FIPSBC-FJA 1.0.2.4 / September 28, 2023;5 months ago (2023-09-28) [3]
C#2.3.0 / February 5, 2024;34 days ago (2024-02-05) [4]
C# FIPSBC-FNA 1.0.2 / February 28, 2023;12 months ago (2023-02-28) [5]
Repository github.com/bcgit/
Written in C# and Java
Platform .NET Framework and Java SE
Type Cryptography API
License MIT License [6]
Website bouncycastle.org

Bouncy Castle is a collection of APIs used in cryptography. It includes APIs for both the Java and the C# programming languages. The APIs are supported by a registered Australian charitable organization: Legion of the Bouncy Castle Inc.

Contents

Bouncy Castle is Australian in origin and therefore American restrictions on the export of cryptography from the United States do not apply to it.

History

Bouncy Castle started when two colleagues were tired of having to re-invent a set of cryptography libraries each time they changed jobs working in server-side Java SE. One of the developers was active in Java ME (J2ME at that time) development as a hobby and a design consideration was to include the greatest range of Java VMs for the library, including those on J2ME. This design consideration led to the architecture that exists in Bouncy Castle. [7]

The project, founded in May 2000, was originally written in Java only, but added a C# API in 2004. The original Java API consisted of approximately 27,000 lines of code, including test code and provided support for J2ME, a JCE/JCA provider, and basic X.509 certificate generation. In comparison, the 1.53 release consists of 390,640 lines of code, including test code. It supports the same functionality as the original release with a larger number of algorithms, plus PKCS#10, PKCS#12, CMS, S/MIME, OpenPGP, DTLS, TLS, OCSP, TSP, CMP, CRMF, DVCS, DANE, EST and Attribute Certificates. The C# API is around 145,000 lines of code and supports most of what the Java API does.

Some key properties of the project are:

On 18 October 2013, a not-for-profit association, the Legion of the Bouncy Castle Inc. was established in the state of Victoria, Australia, by the core developers and others to take ownership of the project and support the ongoing development of the APIs. The association was recognised as an Australian charity with a purpose of advancement in education and a purpose that is beneficial to the community by the Australian Charities and Not-For-Profits Commission on 7 November 2013. [8] The association was authorised to fundraise to support its purposes on 29 November 2013 by Consumer Affairs Victoria.

Architecture

The Bouncy Castle architecture consists of two main components that support the base cryptographic capabilities. These are known as the 'light-weight' API, and the Java Cryptography Extension (JCE) provider. Further components built upon the JCE provider support additional functionality, such as PGP support, S/MIME, etc.

The low-level, or 'light-weight', API is a set of APIs that implement all the underlying cryptographic algorithms. The APIs were designed to be simple enough to use if needed, but provided the basic building blocks for the JCE provider. The intent is to use the low-level API in memory constrained devices (JavaME) or when easy access to the JCE libraries is not possible (such as distribution in an applet). As the light-weight API is just Java code, the Java virtual machine (JVM) does not impose any restrictions on the operation of the code, and at early times of the Bouncy Castle history it was the only way to develop strong cryptography that was not crippled by the Jurisdiction Policy files that prevented JCE providers from performing "strong" encryption.

The JCE-compatible provider is built upon the low-level APIs. As such, the source code for the JCE provider is an example of how to implement many of the "common" crypto problems using the low-level API. Many projects have been built using the JCE provider, including an Open Source Certificate Authority EJBCA.

Certified releases

The C# and Java releases have FIPS 140-2 Level 1 certified streams as well. These differ from the regular releases in that, while the modules are designed in a similar fashion to the regular releases, the low-level APIs are quite different – largely to support the enforcement of controls that FIPS requires when an algorithm is used. In the case of the JCE level of the Java API, the provider is still largely a drop-in replacement for the regular release. The first FIPS-certified releases were made available in November 2016, with the latest Java version being assigned certification number 4616 and the latest C# version being assigned certification number 4416.

Spongy Castle

The Android operating system, as of early 2014, includes a customized version of Bouncy Castle. [9] Due to class name conflicts, this prevents Android applications from including and using the official release of Bouncy Castle as-is. A third-party project called Spongy Castle distributes a renamed version of the library to work around this issue. [10]

Stripy Castle

Originally, it was assumed a FIPS 140-2 version of Spongy Castle could also be done. It turned out due to Android's DEX file processing that for FIPS purposes the provider needs to be installed on the device separate from the application. The FIPS 140-2 release for Android is now called Stripy Castle and is packaged under org.stripycastle. This was needed in order to avoid clashes with Android's version of Bouncy Castle as well as clashes for applications that might be using Spongy Castle and not requiring FIPS 140-2 certified services.

See also

Related Research Articles

Java Platform, Micro Edition or Java ME is a computing platform for development and deployment of portable code for embedded and mobile devices. Java ME was formerly known as Java 2 Platform, Micro Edition or J2ME. As of December 22, 2006, the Java ME source code is licensed under the GNU General Public License, and is released under the project name phoneME.

<span class="mw-page-title-main">OpenSSL</span> Open-source implementation of the SSL and TLS protocols

OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping, and identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS websites.

In computing, the Java Cryptography Architecture (JCA) is a framework for working with cryptography using the Java programming language. It forms part of the Java security API, and was first introduced in JDK 1.1 in the java.security package.

In Microsoft Windows, a Cryptographic Service Provider (CSP) is a software library that implements the Microsoft CryptoAPI (CAPI). CSPs implement encoding and decoding functions, which computer application programs may use, for example, to implement strong user authentication or for secure email.

The Microsoft Windows platform specific Cryptographic Application Programming Interface is an application programming interface included with Microsoft Windows operating systems that provides services to enable developers to secure Windows-based applications using cryptography. It is a set of dynamically linked libraries that provides an abstraction layer which isolates programmers from the code used to encrypt the data. The Crypto API was first introduced in Windows NT 4.0 and enhanced in subsequent versions.

<span class="mw-page-title-main">Hardware security module</span> Physical computing device

A hardware security module (HSM) is a physical computing device that safeguards and manages secrets, performs encryption and decryption functions for digital signatures, strong authentication and other cryptographic functions. These modules traditionally come in the form of a plug-in card or an external device that attaches directly to a computer or network server. A hardware security module contains one or more secure cryptoprocessor chips.

<span class="mw-page-title-main">Network Security Services</span> Collection of cryptographic computer libraries

Network Security Services (NSS) is a collection of cryptographic computer libraries designed to support cross-platform development of security-enabled client and server applications with optional support for hardware TLS/SSL acceleration on the server side and hardware smart cards on the client side. NSS provides a complete open-source implementation of cryptographic libraries supporting Transport Layer Security (TLS) / Secure Sockets Layer (SSL) and S/MIME. NSS releases prior to version 3.14 are tri-licensed under the Mozilla Public License 1.1, the GNU General Public License, and the GNU Lesser General Public License. Since release 3.14, NSS releases are licensed under GPL-compatible Mozilla Public License 2.0.

CryptGenRandom is a deprecated cryptographically secure pseudorandom number generator function that is included in Microsoft CryptoAPI. In Win32 programs, Microsoft recommends its use anywhere random number generation is needed. A 2007 paper from Hebrew University suggested security problems in the Windows 2000 implementation of CryptGenRandom. Microsoft later acknowledged that the same problems exist in Windows XP, but not in Vista. Microsoft released a fix for the bug with Windows XP Service Pack 3 in mid-2008.

The Open Smart Card Development Platform (OpenSCDP) provides a collection of tools that support users in the development, test and deployment of smart card applications. The platform supports GlobalPlatform Scripting, Profile and Messaging technology.

There are various implementations of the Advanced Encryption Standard, also known as Rijndael.

Mbed TLS is an implementation of the TLS and SSL protocols and the respective cryptographic algorithms and support code required. It is distributed under the Apache License version 2.0. Stated on the website is that Mbed TLS aims to be "easy to understand, use, integrate and expand".

wolfSSL is a small, portable, embedded SSL/TLS library targeted for use by embedded systems developers. It is an open source implementation of TLS written in the C programming language. It includes SSL/TLS client libraries and an SSL/TLS server implementation as well as support for multiple APIs, including those defined by SSL and TLS. wolfSSL also includes an OpenSSL compatibility interface with the most commonly used OpenSSL functions.

The Transport Layer Security (TLS) protocol provides the ability to secure communications across or inside networks. This comparison of TLS implementations compares several of the most notable libraries. There are several TLS implementations which are free software and open source.

Dell BSAFE, formerly known as RSA BSAFE, is a FIPS 140-2 validated cryptography library, available in both C and Java. BSAFE was initially created by RSA Security, which was purchased by EMC and then, in turn, by Dell. When Dell sold the RSA business to Symphony Technology Group in 2020, Dell elected to retain the BSAFE product line. BSAFE was one of the most common encryption toolkits before the RSA patent expired in September 2000. It also contained implementations of the RCx ciphers, with the most common one being RC4. From 2004 to 2013 the default random number generator in the library was a NIST-approved RNG standard, widely known to be insecure from at least 2006, containing a kleptographic backdoor from the American National Security Agency (NSA), as part of its secret Bullrun program. In 2013 Reuters revealed that RSA had received a payment of $10 million to set the compromised algorithm as the default option. The RNG standard was subsequently withdrawn in 2014, and the RNG removed from BSAFE beginning in 2015.

The tables below compare cryptography libraries that deal with cryptography algorithms and have API function calls to each of the supported features.

The Enrollment over Secure Transport, or EST is a cryptographic protocol that describes an X.509 certificate management protocol targeting public key infrastructure (PKI) clients that need to acquire client certificates and associated certificate authority (CA) certificates. EST is described in RFC 7030. EST has been put forward as a replacement for SCEP, being easier to implement on devices already having an HTTPS stack. EST uses HTTPS as transport and leverages TLS for many of its security attributes. EST has described standardized URLs and uses the well-known Uniform Resource Identifiers (URIs) definition codified in RFC 5785.

The IBM 4765 PCIe Cryptographic Coprocessor is a hardware security module (HSM) that includes a secure cryptoprocessor implemented on a high-security, tamper resistant, programmable PCIe board. Specialized cryptographic electronics, microprocessor, memory, and random number generator housed within a tamper-responding environment provide a highly secure subsystem in which data processing and cryptography can be performed.

The IBM 4767 PCIe Cryptographic Coprocessor is a hardware security module (HSM) that includes a secure cryptoprocessor implemented on a high-security, tamper resistant, programmable PCIe board. Specialized cryptographic electronics, microprocessor, memory, and random number generator housed within a tamper-responding environment provide a highly secure subsystem in which data processing and cryptography can be performed. Sensitive key material is never exposed outside the physical secure boundary in a clear format.

The IBM 4768 PCIe Cryptographic Coprocessor is a hardware security module (HSM) that includes a secure cryptoprocessor implemented on a high security, tamper resistant, programmable PCIe board. Specialized cryptographic electronics, microprocessor, memory, and random number generator housed within a tamper-responding environment provide a highly secure subsystem in which data processing and cryptography can be performed. Sensitive key material is never exposed outside the physical secure boundary in a clear format.

References

  1. "Release Notes - bouncycastle.org". 13 November 2023. Retrieved 18 November 2023.
  2. "Java LTS Resources - bouncycastle.org". 22 January 2024. Retrieved 22 January 2024.
  3. "Java FIPS Resources - bouncycastle.org". 28 September 2023. Retrieved 29 September 2022.
  4. "The Legion of the Bouncy Castle C# Cryptography APIs". 5 February 2024. Retrieved 6 February 2024.
  5. "C# .NET FIPS Resources - bouncycastle.org". 28 February 2023. Retrieved 28 February 2023.
  6. "Bouncy Castle - LICENSE". bouncycastle.org. Legion of the Bouncy Castle.
  7. "Open Source Development and Sustainability: A Look at the Bouncy Castle Project" (PDF). Linux Foundation Collaboration Summit, 2016. Archived from the original (PDF) on 29 August 2017.
  8. "Australian Charities and Not-For-Profits Commission Register" . Retrieved 6 July 2019.
  9. Reimer, Helmut; Pohlmann, Norbert; Schneider, Wolfgang, eds. (2014). ISSE 2014 Securing Electronic Business Processes (PDF). Wiesbaden: Springer Fachmedien Wiesbaden. p. 205. doi:10.1007/978-3-658-06708-3. ISBN   9783658067076. S2CID   32601495.
  10. "Spongy Castle" . Retrieved 29 April 2013 via Github.