## The Bouncy Castle C# Cryptographic API

### Contents:

1. The Bouncy Castle Cryptographic C#® API
   1. 1. Contents:
      2. License & Contributors:
      3. Features:
      4. How To Build.
      5. The Source:
      6. Documentation:
      7. For first time users.
      8. Notes:
         1. Release 2.5.0
         2. Release 2.4.0
         3. Release 2.3.1
         4. Release 2.3.0
         5. Release 2.2.1
         6. Release 2.2.0
         7. Release 2.1.1
         8. Release 2.1.0
         9. Release 2.0.0
         10. Release 1.9.0
         11. Release 1.8.10
         12. Release 1.8.9
         13. Release 1.8.8
         14. Release 1.8.7
         15. Release 1.8.6
         16. Release 1.8.5
         17. Release 1.8.4
         18. Release 1.8.3
         19. Release 1.8.2
         20. Release 1.8.1
         21. Release 1.8.0
         22. Release 1.7
         23. Release 1.6.1
         24. Release 1.6
         25. Release 1.5
         26. Release 1.4
         27. Release 1.3
         28. Release 1.2
         29. Release 1.1
         30. Release 1.0
         31. Tuesday Febuary 1, 2005
         32. Sunday December 12, 2004
      9. Trademarks.

### License & Contributors:

See License & Contributors files.

### Patents:

Some of the algorithms in the Bouncy Castle APIs are patented in some places. It is up to the user of the library to be aware of their own legal situation, however we have been asked to specifically mention the patents below, in the following terms, at the request of the patent holder.

The BC distribution contains implementations of EC MQV as described in RFC 5753, "Use of ECC Algorithms in CMS". In line with the conditions in:

http://www.ietf.org/ietf-ftp/IPR/certicom-ipr-rfc-5753.pdf

We state, where EC MQV has not otherwise been disabled or removed: "The use of this product or service is subject to the reasonable, non-discriminatory terms in the Intellectual Property Rights (IPR) Disclosures of Certicom Corp. at the IETF for Use of Elliptic Curve Cryptography (ECC) Algorithms in Cryptographic Message Syntax (CMS) implemented in the product or service."

### Features:

- Generation and parsing of PKCS-12 files.
- X.509: Generators and parsers for V1 and V3 certificates, V2 CRLs and attribute certificates.
- PBE algorithms supported by PbeUtilities: PBEwithMD2andDES-CBC, PBEwithMD2andRC2-CBC, PBEwithMD5andDES-CBC, PBEwithMD5andRC2-CBC, PBEwithSHA1andDES-CBC, PBEwithSHA1andRC2-CBC, PBEwithSHA-1and128bitRC4, PBEwithSHA-1and40bitRC4, PBEwithSHA-1and3-keyDESEDE-CBC, PBEwithSHA-1and2-keyDESEDE-CBC, PBEwithSHA-1and128bitRC2-CBC, PBEwithSHA-1and40bitRC2-CBC, PBEwithHmacSHA-1, PBEwithHmacSHA-224, PBEwithHmacSHA-256, PBEwithHmacRIPEMD128, PBEwithHmacRIPEMD160, and PBEwithHmacRIPEMD256.
- Signature algorithms supported by SignerUtilities: MD2withRSA, MD4withRSA, MD5withRSA, RIPEMD128withRSA, RIPEMD160withECDSA, RIPEMD160withRSA, RIPEMD256withRSA, SHA-1withRSA, SHA-224withRSA, SHA-256withRSAandMGF1, SHA-384withRSAandMGF1, SHA-512withRSAandMGF1, SHA-1withDSA, and SHA-1withECDSA.
- Symmetric key algorithms: AES, Blowfish, Camellia, CAST5, CAST6, ChaCha, DES, DESede, GOST28147, HC-128, HC-256, IDEA, ISAAC, Noekeon, RC2, RC4, RC5-32, RC5-64, RC6, Rijndael, Salsa20, SEED, Serpent, Skipjack, SM4, TEA/XTEA, Threefish, Tnepres, Twofish, VMPC and XSalsa20.
- Symmetric key modes: CBC, CFB, CTS, GOFB, OFB, OpenPGPCFB, and SIC (or CTR).
- Symmetric key paddings: ISO10126d2, ISO7816d4, PKCS-5/7, TBC, X.923, and Zero Byte.
- Asymmetric key algorithms: ElGamal, DSA, ECDSA, NaccacheStern and RSA (with blinding).
- Asymmetric key paddings/encodings: ISO9796d1, OAEP, and PKCS-1.
- AEAD block cipher modes: CCM, EAX, GCM and OCB.
- Digests: GOST3411, Keccak, MD2, MD4, MD5, RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3, SM3, Tiger, and Whirlpool.
- XOFs: SHAKE.
- Signer mechanisms: DSA, ECDSA, ECGOST3410, ECNR, Ed25519, Ed448, GOST3410, ISO9796d2, PSS, RSA, X9.31-1998.
- Key Agreement: Diffie-Hellman, EC-DH, EC-MQV, J-PAKE, SRP-6a, X25519, X448.
- Macs: CBCBlockCipher, CFBBlockCipher, CMAC, GMAC, GOST28147, HMac, ISO9797 Alg. 3, Poly1305, SipHash, SkeinMac, VMPCMAC.
- PBE generators: PKCS-12, and PKCS-5 - schemes 1 and 2.
- OpenPGP (RFC 4880)
- Cryptographic Message Syntax (CMS, RFC 3852), including streaming API.
- Online Certificate Status Protocol (OCSP, RFC 2560).
- Time Stamp Protocol (TSP, RFC 3161).
- TLS/DTLS client/server up to version 1.2, with support for the most common ciphersuites and extensions, and many less common ones. Non-blocking API available.
- Elliptic Curve Cryptography: support for generic F2m and Fp curves, high-performance custom implementations for many standardized curves.
- Reading/writing of PEM files, including RSA and DSA keys, with a variety of encryptions.
- PKIX certificate path validation

Porting notes from the old ASN.1 library For the most part code using the old subset of ASN.1 classes should be easy to transfer, providing the following changes are made:

- DERObject becomes Asn1Object
- DEREncodable becomes Asn1Encodable
- GetDERObject() becomes ToAsn1Object()
- BERConstructedOctetString becomes BerOctetString
- If you were using the older mutable DERConstructedSequence/Set and BERConstructedSequence, use an Asn1EncodableVector in conjunction with DerSequence/Set and BerSequence
- BERInputStream and DERInputStream are replaced with Asn1InputStream
- AsymmetricKeyParameter is now in the Org.Bouncycastle.Crypto namespace

### How To Build.

(NOTE: This build system is essentially obsolete and will be withdrawn after the 1.8 series. We have introduced MSBuild project files which will probably be a preferred option if you want to build yourself.)

The BC C# API uses NAnt (http://nant.sourceforge.net) to provide a platform independent build environment (suggested version NAnt 0.90). There is also a solution file for Visual Studio, and for MonoDevelop. The API works with .NET Framework 1.1 and above. It has been successfully built and tested with Mono versions from 1.1.13 onwards. The source code can be built for .NET Compact Framework 1.0 by setting the compilation flag NETCF_1_0, or .NET Compact Framework 2.0 by setting NETCF_2_0, or Silverlight 2 by setting SILVERLIGHT.

Using a command prompt (DOS window), cd into the 'crypto' folder of this distribution.
Use,

- 'nant' without arguments to compile debug code, the tests and run the tests.
- 'nant compile-release' to compile release code.
- 'nant compile-debug' to compile debug code.
- 'nant test' to run the included unit tests (using NUnit; you may need to edit the build file to set the location where NUnit is installed).

Output:
The compiled API can be found in the 'api/bin/release' & 'api/bin/debug' directories.
The compiled tests can be found in the 'test/bin' directory (by default a debug build is used for testing).

### The Source:

The main source code can be found in the 'src' directory.

### Documentation:

There is limited documentation available at the moment. Some of the source contains XML comments, but this is a work in progress. We welcome contributions of documentation, which often requires only formatting changes from the corresponding javadoc in the Java API.

### For first time users.

Java® heritage,
The Bouncy Castle C# API is a port of the Bouncy Castle Java APIs. Approximately %80 of the functionality in the Java build has now been ported. For the most part, the naming conventions of the .NET platform have been adopted. The C# API is constantly kept uptodate with bug fixes and new test cases from the Java build (and vice versa sometimes), thus benefitting from the large user base and real-world use the Java version has seen.
Please consider.
The Bouncy Castle C# API is a library of transformations that when combined properly will enable developers to create standard conforming cryptographic systems. In order to use this API you must have some knowledge of how to build cryptographic systems, namely what transformations to use and the when, where and why of their use. Developing good cryptographic systems takes practice and understanding.
There are many resources available online and in book shops; please use those to your advantage.

### Notes:

#### Release 2.5.0, Sunday December 1, 2024

##### Defects Fixed

- Fixed tag for unprotectedAttrs field of Asn1.Cms.EncryptedData (regression in 2.4.0).
- X509Name: Fixed whitespace escaping on output, and NameAtBirth lookup.

##### Additional Features and Functionality

- Added support for modified UTF-8 in JKS.
- (D)TLS: Removed redundant verification of self-generated RSA signatures.
- Added support for the PQC algorithms ML-DSA (including pre-hash), ML-KEM, and SLH-DSA (including pre-hash).
- Added ParametersWithContext class to support signature contexts for ML-DSA and SLH-DSA.
- Added support for Argon2.
- TLS: Added draft ML-KEM support (draft-connolly-tls-mlkem-key-agreement-03).
- Ascon: Implemented latest algorithms: AsconHash256, AsconXof128, AsconCXof128, AsconAead128; deprecated prototypes: AsconDigest, AsconXof, AsconEngine.

##### Additional Notes

- To avoid potential intellectual property issues, Kyber (precursor of ML-KEM) was completely removed. Since that already created a backward compatibility break, we took the opportunity to also remove SIKE.
- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.4.0, Monday May 27, 2024

##### Defects Fixed

- Fixed the input length check for the CCM cipher mode.
- CMS: Fix recipient selection based on certificate SubjectKeyIdentifier.

##### Additional Features and Functionality

- Embed Picnic and Sike data in source to make it trim-friendly.
- Auto-adjust DateTime precision for GeneralizedTime in X.509 (and OCSP).

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.3.1, Tuesday May 7, 2024

##### Defects Fixed

- TLS: Fixed timing side-channel for RSA key exchange (CVE-2024-30171 - "The Marvin Attack").
- PSS: Fixed regression in 2.3.0 when updating signer from a span.
- EdDSA: Fixed verification infinite loop (regression in 2.1.0) - see corresponding bc-java issue (CVE-2024-30172).
- EC: Restricted m value in F2m curves (CVE-2024-29857).

##### Additional Features and Functionality

- ASN.1: Limited OID contents to 4096 bytes.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.3.0, Monday February 5, 2024

##### Defects Fixed

- AsconEngine: Fixed a buffering bug when decrypting across multiple ProcessBytes calls (ascon128a unaffected).
- DTLS: Fixed an exception during server handshake when 1.2 is negotiated and the ClientHello contained no extensions.
- HC128Engine now strictly requires 128 bits of IV.
- DTLS: Fixed server support for client_certificate_type extension.
- DTLS: Fixed retransmission in response to re-receipt of an aggregated ChangeCipherSpec.
- SM2Signer: Fixed to support reuse (i.e. auto-reset after GenerateSignature or VerifySignature).

##### Additional Features and Functionality

- DTLS: Significantly improved performance of DtlsVerifier.
- Added Rfc5649WrapEngine.
- ASN.1: Added support for "DL" encoding (Asn1Encodable.DL), which is like BER except that encodings always use the definite-length form.
- Added support for PBE SHA-384 and SHA-512 HMAC algorithms, e.g. in Pkcs12Store.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.2.1, Friday April 21, 2023

##### Defects Fixed

- Due to a defect in the build process, the 2.2.0 release assembly was not optimized. This has been rectified.
- Fixed a regression in GcmBlockCipher that reduced the output limit to ~2^31 blocks instead of ~2^32 (net60 unaffected).
- Fixed incomplete DTLS 1.2 Connection ID support for the case of a block cipher being negotiated with the encrypt_then_mac extension (net60 unaffected).

##### Additional Features and Functionality

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.2.0, Monday April 17, 2023

##### Defects Fixed

- Fixed non-8-aligned IPv4 netmask parsing.
- Fixed the ParallelHash copy constructor.

##### Additional Features and Functionality

- Fixed rethrow syntax across the project, which should give more informative stack traces where relevant.
- Added support for generating/validating alternative signatures for certificates and CRLs.
- RFC 9146: Added support for connection ID to DTLS.
- Initial DTLS handshake resend time is now configurable.
- Added utilities to support generation and parsing of OpenSSH public and private key formats.
- The assemblies within the NuGet package are now also codesigned.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.1.1, Saturday February 18, 2023

This is a hotfix release to fix the missing symbols for the 2.1.0 release. We have now added an snupkg with symbols, enabled SourceLink, and made the build deterministic. There was no change to functionality.

#### Release 2.1.0, Saturday February 18, 2023

##### Defects Fixed

- Fixed a rounding issue with FF1 Format Preserving Encryption algorithm for certain radices.
- Fixed RFC3394WrapEngine handling of 64 bit keys.
- PkixCertPathValidator: fixed fetching of DateOfCertGen extension.
- PkixCertPathValidator: correctly remove ExtendedKeyUsage from critical extensions (https://github.com/bcgit/bc-csharp/issues/395).
- PkixNameConstraintValidator: fixed special handling of 'serialNumber' in RDNs.

##### Additional Features and Functionality

- The BIKE implementation has been updated according to the NIST PQC Round 4 modifications.
- The HQC implementation has been updated according to the NIST PQC Round 4 modifications.
- EdDSA verification now conforms to the recommendations of Taming the many EdDSAs, in particular cofactored verification. As a side benefit, Pornin's basis reduction is now used for EdDSA verification, giving a significant performance boost.
- Major performance improvements for Anomalous Binary (Koblitz) Curves.
- Added implementations of Ascon AEAD, Hash and XOF algorithms.
- Added AriaWrapEngine, an implementation of RFC 3394 wrapping for the ARIA cipher.
- User customization of the GCM multiplier has been obsoleted. We recommend no longer supplying a custom multiplier to GcmBlockCipher.
- Several large properties files used by the PQC algorithms have been compressed in order to reduce the size of the assembly.
- Debug symbols have been extracted to a separate snupkg package.
- Major performance improvements for GCM bulk processing when Pclmulqdq, Ssse3 intrinsics available.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 2.0.0, Tuesday November 15, 2022

With this release we have finally moved to building for modern .NET versions (directly targeted frameworks: net461, netstandard2.0, net6.0), and distributing using NuGet (package name BouncyCastle.Cryptography). We have also adopted Semantic Versioning 2.0.0 for package versioning.

There are backward compatibility breaks with this release, but they are minor and the overall process of migrating from either Release 1.9.0 (or Portable.BouncyCastle) should be smooth for most users. The legacy TLS implementation (Org.BouncyCastle.Crypto.Tls) has been removed and users should migrate to the new implementation (Org.BouncyCastle.Tls).

##### Dedication

This release is dedicated to Claire Novotny, who has been keeping the project alive for the past several years in the form of the Portable.BouncyCastle NuGet package.

##### IMPORTANT

- This release uses a new strong name from earlier versions (and other NuGet packages derived from them).
- This release is now signed by "Legion of the Bouncy Castle Inc.".

##### Defects Fixed

- Fixed TLS 1.3 Export Keying Material (https://github.com/bcgit/bc-java/issues/1133).
- BasicOcspResponseGenerator now allows nullable 'nextUpdate' (https://github.com/bcgit/bc-csharp/issues/371).

##### Additional Features and Functionality

- When using the net6.0 version, several algorithms have been accelerated using intrinsics, most notably AES, Chacha, Haraka, and GCM. So far this is limited to X86; Arm code will follow in future versions. The current usages are opportunistic i.e. constrained by the existing public API in what they can achieve. Use Org.BouncyCastle.Crypto.AesUtilities.CreateEngine() (instead of new AesEngine) to get an accelerated AES engine if available.
- Added implementations of the following NIST Post-Quantum Cryptography Standardization algorithms: CRYSTALS-Dilithium, CRYSTALS-Kyber, Falcon, SPHINCS+, Classic McEliece, FrodoKEM, NTRU, NTRU Prime, Picnic, Saber, BIKE, and SIKE. These should all be considered EXPERIMENTAL and subject to change or removal. SIKE in particular is already slated for removal and should be used for research purposes only.
- Many APIs have now added variants of existing methods to enable use of Span (only available in the net6.0 version).
- The library has been converted to use generic collections throughout.
- (D)TLS: By default, only (D)TLS 1.2 and TLS 1.3 are offered now. Earlier versions are still supported if explicitly enabled. Users may need to check they are offering suitable cipher suites for TLS 1.3.
- (D)TLS: RFC 9266 'tls-exporter' channel binding.
- (D)TLS: RFC 7250 Raw Public Keys.
- Added ASN.1 support for the Relative Object Identifier type.
- Support additional input in deterministic (EC)DSA.
- BigInteger can now export directly to uint[] in either big- or little-endian formats.
- Added basic support for JKS keystores.
- Added support for the Blake2xs and Blake3 digests.
- OpenPGP: added support for XDH, EdDSA (https://github.com/bcgit/bc-csharp/issues/345).

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.9.0, Sunday October 17, 2021

##### Defects Fixed

- Key sizes are now checked strictly in TwofishEngine.
- Fixed bzip2 compression of empty contents.
- Handle CRL with no NextUpdate properly during CertPath validation.
- Skip marker packets when reading various PGP data.
- Ignore PGP signatures with invalid version.

##### Additional Features and Functionality

- A new TLS API (Org.BouncyCastle.Tls) now replaces the old one (Org.BouncyCastle.Crypto.Tls), which should be considered obsolete. The new API includes support for TLS 1.3.
- Added support for Format Preserving Encryption.
- Added support for ParallelHash and TupleHash.
- Added support for the ARIA cipher.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.10, Tuesday February 16, 2021

##### Defects Fixed

- Fixed CMS signature verification for RSASSA-PSS when signed attributes are not present.
- The output size for SHAKE128 (SHAKE256) when used as a fixed-length digest is now 256 (512) bits (also applies to cSHAKE).

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.9, Tuesday December 8, 2020

##### Defects Fixed

- The TimeStampToken generator is now using PkcsObjectIdentifiers.IdAASigningCertificateV2 for the generating SigningCertificateV2.

##### Additional Features and Functionality

- Added cSHAKE digest and KMAC.
- Added support for PKCS#5 Scheme 2 to Pkcs12Store.
- Improved performance for GCM.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.8, Monday September 21, 2020

##### Additional Features and Functionality

- Updated TimeStampTokenGenerator from bc-java.
- Improved performance for constant-time modular inversion ("safegcd").
- Improved performance for binary EC fields.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.7, Thursday July 30, 2020

##### Defects Fixed

- ChaCha20Poly1305 could fail for large (>~2GB) files. This has been fixed.
- EdDSA verifiers now reset correctly after rejecting overly long signatures.
- DTLS: Fixed infinite loop on IO exceptions.

##### Additional Features and Functionality

- DTLS: Retransmission timers now properly apply to flights monolithically.
- DTLS: Added support for an overall handshake timeout.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.6, Friday February 21, 2020

##### Defects Fixed

- EdDSA verifiers now reject overly long signatures.
- Fixed field reduction for custom secp128r1 curve.
- ASN.1: Enforce no leading zeroes in OID branches (longer than 1 character).

##### Additional Features and Functionality

- TLS: BasicTlsPskIdentity now reusable (returns cloned array from GetPsk).
- Improved performance for multiple ECDSA verifications using same public key.
- Support has been added for ChaCha20-Poly1305 AEAD mode from RFC 7539.
- PKCS12: Improved support for certificate-only key stores without password.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.5, Thursday January 31, 2019

##### Additional Features and Functionality

- Support added for encoding and decoding of GOST3410-2012 keys
- Basic support added for CMP (RFC 4210) and CRMF (RFC 4211), including the PKI archive control.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.4, Saturday October 27, 2018

##### IMPORTANT

- This is the final feature release with support for legacy .NET platforms. From 1.9.0 we will be targeting more modern .NET frameworks (see https://github.com/bcgit/bc-csharp/pull/68) and updating our build and packaging systems. The 1.8.x series will continue to receive bug fixes, but limited new functionality.

##### Defects Fixed

- Rfc3211WrapEngine would not properly handle messages longer than 127 bytes. This has been fixed.

##### Additional Features and Functionality

- Restrictions on the output sizes of the Blake2b/s digests have been removed.
- RFC 7748: Higher-level support for X25519 and X448 has been added.
- RFC 8032: Higher-level support for Ed25519 and Ed448 has been added.
- Implementation of the SM4 block cipher has been added.
- Added support for Plain ECDSA (a.k.a CVC-ECDSA).

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.3, Saturday August 11, 2018

##### IMPORTANT

- In this release, the TLS library has moved to a whitelisting approach for client-side validation of server-presented Diffie-Hellman (DH) parameters. In the default configuration, if a ciphersuite using ephemeral DH is selected by the server, the client will abort the handshake if the proposed DH group is not one of those specified in RFC 3526 or RFC 7919, or if the DH prime is < 2048 bits. The client therefore no longer offers DH ciphersuites by default. See also the paper "Prime and Prejudice: Primality Testing Under Adversarial Conditions".

##### Additional Features and Functionality

- Further work has been done on improving SHA-3 performance.
- EC key generation and signing now use cache-timing resistant table lookups.
- RFC 7748: Added low-level implementations of X25519 and X448.
- RFC 8032: Added low-level implementations of Ed25519 and Ed448.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.2, Monday April 9, 2018

##### Security Advisory

- Carry propagation bugs in the implementation of squaring for several raw math classes have been fixed (Org.BouncyCastle.Math.Raw.Nat???). These classes are used by our custom elliptic curve implementations (Org.BouncyCastle.Math.Ec.Custom.**), so there was the possibility of rare (in general usage) spurious calculations for elliptic curve scalar multiplications. Such errors would have been detected with high probability by the output validation for our scalar multipliers. We consider these bugs to be exploitable for static ECDH with long-term keys, per "Practical realisation and elimination of an ECC-related software bug attack", Brumley et.al.

##### IMPORTANT

- This release brings our Poly1305 implementation into line wih RFC 7539, which breaks backward compatibility. The essential difference from 1.8.1 is that the two halves of the 32-byte Poly1305 key have swapped places. If you have persisted Poly1305 keys, or are interoperating with other Poly1305 implementations, you may need to account for this change when migrating to 1.8.2.

##### Defects Fixed

- DTLS now supports records containing multiple handshake messages.

##### Additional Features and Functionality

- TLS: support for ClientHello Padding Extension (RFC 7685).
- TLS: support for ECDH_anon key exchange.
- BCrypt implementation added.
- BLAKE2b and BLAKE2s implementations added.
- GOST R 34.11-2012 implementation added.
- DSTU-7564 message digest implementation added.
- SM2 signatures, key exchange, and public key encryption implementations added.

##### Additional Notes

- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.1, Monday December 28, 2015

##### Security Advisory

- (D)TLS 1.2: Motivated by CVE-2015-7575, we have added validation that the signature algorithm received in DigitallySigned structures is actually one of those offered (in signature_algorithms extension or CertificateRequest). With our default TLS configuration, we do not believe there is an exploitable vulnerability in any earlier releases. Users that are customizing the signature_algorithms extension, or running a server supporting client authentication, are advised to double-check that they are not offering any signature algorithms involving MD5.

##### Additional Features and Functionality

- Added support for ASN.1 GraphicString and VideotexString types.
- Problems with DTLS record-layer version handling were resolved via BJA-584, making version negotiation work properly.

##### Additional Notes

- See list of resolved issues at Bouncy Castle JIRA C# 1.8.1.
- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.8.0, Sunday November 22, 2015

##### IMPORTANT

- The Serpent cipher as of 1.8.0 is incompatible with the behaviour of Serpent in earlier releases; it has been modified to conform to the standard byte-order interpretation for blocks (and keys). The previous behaviour is available from 1.8.0 as the "Tnepres" cipher. See BMA-52 for more information if this may affect you.

##### Additional Features and Functionality

- IV only re-initialisation is supported by using null as the key parameter when creating a ParametersWithIV object.
- CMS Enveloped and AuthenticatedData now support OriginatorInfo.
- Support for ECDSA_fixed_ECDH authentication has been added to the TLS client.
- Support for the Features signature sub-packet has been added to the PGP API.
- Classes involved in CRL manipulation have been rewritten to reduce memory requirements for handling and parsing extremely large CRLs.
- An implementation of Password Authenticated Key Exchange by Juggling (J-PAKE) has been added.
- Support has been added for SHA-512/224, SHA-512/256, as well as a general SHA-512/t in the lightweight API.
- The TSP API now supports generation of certIDs based on digests other than SHA-1.
- OCSP responses can now be included in CMS SignedData objects.
- The SipHash MAC algorithm has been added.
- DRBGs from NIST SP 800-90A (DualEC excluded) have been added to the Crypto.Prng namespace together with SecureRandom builders.
- Support has been added for OCB mode.
- DSA version 2 parameter and key generation is now supported.
- A new interface IMemoable has been added for objects that can copy in and out their state. The digest classes now support this. A special class NonMemoableDigest has been added which hides the IMemoable interface where it should not be available.
- TDEA is now recognised as an alias for DESede.
- Support has been added for NIST SP 800-38D - GMAC to AES and other 128 bit block size algorithms.
- The TLS API now supports TLS/DTLS 1.2 for both client and server
- Full support is now provided for client-side auth in the D/TLS server code.
- TLS: server-side support for DHE key exchange.
- TLS: server-side support for PSK and SRP ciphersuites.
- TLS: (EC)DSA now supports signatures with non-SHA1 digests.
- TLS: support for ECDHE_ECDSA/AES/CCM ciphersuites from RFC 7251.
- The TLS/DTLS code now includes a non-blocking API.
- RFC 6637 ECDSA and ECDH support has been added to the OpenPGP API.
- Implementations of Threefish and Skein have been added.
- Implementation of the SM3 digest has been added.
- Implementations of XSalsa20 and ChaCha have been added. Support for reduced round Salsa20 has been added.
- Support has been added for RFC 6979 Deterministic DSA/ECDSA.
- Support for the Poly1305 MAC has been added.
- GCM and GMAC now support tag lengths down to 32 bits.
- Custom implementations for many of the NIST and SEC elliptic curves have been added, resulting in drastically improved performance. They can be accessed via the Crypto.EC.CustomNamedCurves class and are generally selected by other internal APIs in place of the generic implementations.
- Automatic EC point validation added, both for decoded inputs and multiplier outputs.
- Support has been added for X9.31-1998 DRBG.
- Support has been added for the SHA3 family of digests, including SHAKE128 and SHAKE256. An implementation of the draft standard has been added as 'Keccak'.
- The ASN.1 parser for ECGOST private keys will now parse keys encoded with a private value represented as an ASN.1 INTEGER.
- SubjectPublicKeyInfoFactory now supports DSA parameters.
- Improved performance of BigInteger.ModPow and random prime generation.
- SecureRandom instances now seeded by RNGCryptoServiceProvider (where available).
- An initial port of the Java "operators" mechanism has been introduced to support overriding of cryptographic primitives in high-level APIs e.g. for signing using an external provider.

##### Additional Notes

- See list of resolved issues at Bouncy Castle JIRA C# 1.8.0.
- See the (cumulative) list of GitHub pull requests that we have accepted at bcgit/bc-csharp.

#### Release 1.7, Thursday April 7, 2011

##### Additional Features and Functionality

- TLS now supports client authentication.
- TLS now supports compression.
- TLS now supports ECC cipher suites (RFC 4492).
- Library can now be built for Silverlight (2.0 and above).
- ASN.1 classes for CRMF (RFC 4211) and CMP (RFC 4210) have been added.
- Further performance improvements to GCM mode.
- BufferedBlockCipher will now always reset after a DoFinal().
- An IV can now be passed to an Iso9797Alg3Mac

##### Additional Notes

- See list of resolved issues at Bouncy Castle JIRA C# 1.7

#### Release 1.6.1, Monday February 8, 2010

- A point release to rectify some problems with the released assembly of 1.6 version.

#### Release 1.6, Thursday February 4, 2010

##### Defects Fixed

- X509DefaultEntryConverter was not recognising telephone number as a PrintableString field. This has been fixed.
- OpenPGP now supports UTF-8 in file names for literal data.

##### Security Advisory

- This version has been specifically reviewed to eliminate possible timing attacks on algorithms such as GCM and CCM mode.

##### Additional Features and Functionality

- Support for PSS signatures has been added to CMS.
- SubjectKeyIdentifier now supports both methods specified in RFC 3280, section 4.2.1.2 for generating the identifier.
- Performance of GCM mode has been greatly improved (on average 10x).
- Support for mac lengths of 96, 104, 112, and 120 bits has been added to existing support for 128 bits in GCMBlockCipher.
- Support for raw signatures has been extended to RSA, RSA-PSS and ECDSA. RSA support can be used in CmsSignedDataStreamGenerator to support signatures without signed attributes.
- Support for EC MQV has been added to the light weight API and the CMS library.

##### Additional Notes

- See list of resolved issues at Bouncy Castle JIRA C# 1.6

#### Release 1.5, Tuesday August 18, 2009

##### Defects Fixed

- Correct the ASN.1 class for AuthorityInformationAccess.
- In the Bcpg libs, armored output now inserts the correct version string.
- EssCertIDv2 encoding now complies with RFC 5035.
- ECDSA now computes correct signatures for oversized hashes when the order of the base point is not a multiple of 8 in compliance with X9.62-2005.
- Standard name "DiffieHellman" is now supported in factory classes.
- Better support for equality tests for '#' encoded entries has been added to X509Name.
- '=' inside a X509Name was not being properly escaped. This has been fixed.
- ApplicationSpecific ASN.1 tags are now recognised in BER data. The GetObject() method now handles processing of arbitrary tags.
- Multiplication by negative powers of two is fixed in BigInteger.
- Multiple countersignature attributes are now correctly collected.
- Two bugs in HC-128 and HC-256 related to sign extension and byte swapping have been fixed. The implementations now pass the latest ecrypt vector tests.

##### Security Advisory

- The effect of the sign extension bug was to decrease the key space the HC-128 and HC-256 ciphers were operating in and the byte swapping inverted every 32 bits of the generated stream. If you are using either HC-128 or HC-256 you must upgrade to this release.

##### Additional Features and Functionality

- PKIX certificate path validation
- Accept duplicate PKCS#9 FriendlyName attributes in PKCS#12 keystore.
- Add support for PKCS#5 Scheme 2 keys.
- Camellia performance improved.
- A smaller version of Camellia, CamelliaLightEngine has also been added.
- CmsSignedData generation now supports SubjectKeyIdentifier as well as use of issuer/serial.
- A CMS PBE key holder for UTF8 keys has been added to the CMS API.
- Salt and iteration count can now be recovered from PasswordRecipientInformation.
- Support for reading and extracting personalised certificates in PGP Secret Key rings has been added.
- Support for EAC algorithms has been added to CMS.
- Asn1Dump now supports a verbose mode for displaying the contents of octet and bit strings.
- Support for the SRP-6a protocol has been added.

##### Additional Notes

- See also the list of resolved issues at Bouncy Castle JIRA C# 1.5

#### Release 1.4, Thursday August 8, 2008

##### Defects Fixed

- The GeneralName string constructor now supports IPv4 and IPv6 address parsing.
- EAX mode was not handling non-zero offsetted data correctly and failing. This has been fixed.
- EAX mode ciphers were not resetting correctly after a DoFinal/Reset. This has been fixed.
- Some boolean parameters to IssuingDistributionPoint were being reversed. This has been fixed.
- A zero length RDN would cause an exception in an X509Name. This has been fixed.
- Specifying a greater than 32bit length for a stream and relying on the default BcpgOutputStream resulted in corrupted data. This has been fixed.
- Pkcs7Padding validation would not fail if pad length was 0. This has been fixed.
- Signature creation time was not being properly initialised in new V4 PGP signature objects although the encoding was correct. This has been fixed.
- The '+' character can now be escaped or quoted in the constructor for X509Name.
- IV handling in CMS for SEED and Camellia was incorrect. This has been fixed.
- ASN.1 stream parser now throws exceptions for unterminated sequences.
- X509CertificateParser/X509CrlParser now handle multiple certificates/CRLs in streams that don't support seeking.
- The CertID class used by the TSP library was incomplete. This has been fixed
- \# is now properly recognised in the X509Name class.
- BigInteger.ModInverse was failing for negative values. This has been fixed.
- CMS API now supports RSASSA-PSS signatures with explicit salt length.

##### Additional Features and Functionality

- ASN.1 libs now support high tag numbers.
- Galois/Counter Mode (GCM) has been added.
- The TSP API now supports parsing and validation of responses with V2 signing certificate entries.
- Unnecessary local ID attributes on certificates in PKCS12 files are now automatically removed.
- New Pkcs12StoreBuilder class supports generation of PKCS12 files with both certificates and keys protected by 3DES.
- Certifications associated with user attributes can now be created, verified and removed in OpenPGP.
- API support now exists for CMS countersignature reading and production.
- A new class LazyAsn1InputStream supports lazy evaluation of DER sequences and sets, considerably reducing memory requirements in some scenarios.
- KeyPurposeId class has been updated for RFC 4945.
- Initial support has been added for HP_CERTIFICATE_REQUEST in the TLS API.
- PGP example programs now handle blank names in literal data objects.
- The ProofOfPossession class now better supports the underlying ASN.1 structure.

##### Additional Notes

- Due to problems for some users caused by the presence of the IDEA algorithm, an implementation is no longer included in the default assembly. Only the assembly named BouncyCastle.CryptoExt now includes IDEA.
- See also the list of resolved issues at Bouncy Castle JIRA C# 1.4

#### Release 1.3, Saturday December 8, 2007

ASN.1 stream parsing now handles definite length encodings efficiently.
Buffering in the streaming CMS has been reworked. Throughput is now usually higher and the behaviour is more predictable.
BcpgInputStream now handles data blocks in the 2**31->2**32-1 range.
Some confusion over the parameters J and L in connection with Diffie-Hellman has been resolved.
Added CryptoApiRandomGenerator, a wrapper for RNGCryptoServiceProvider.
Added VMPC stream cipher, VMPCMAC and a VMPC-based implementation of IRandomGenerator.
Added support in OpenPGP for fetching keyrings by case-insensitive user ID [#BMA-8].
Fixed a vulnerability of CMS signatures that do not use signed attributes (Bleichenbacher RSA forgery).
Fixed a bug causing second and later encrypted objects to be ignored in KeyBasedFileProcessor example.
Fixed case-sensitivity issue with deletion from a PKCS#12 file.
Fixed problem overwriting entities in a PKCS#12 file.
Fixed PgpUtilities.MakeKeyFromPassPhrase for 8-bit characters [#BMA-13].
Fixed duplicate certificate problem in Pkcs12Store.Save [#BMA-12].
Fixed NAnt build under Mono [#BMA-10].
Fixed BigInteger.ModPow for negative exponents [#BMA-7].

#### Release 1.2, Thursday July 5, 2007

Source now builds on .NET Compact Framework 1.0 (compilation flag NETCF_1_0).
Release assembly now signed with a strong name.
Added CCM and EAX block cipher modes.
Added Noekeon block cipher.
Added HC-128, HC-256, and ISAAC stream ciphers.
Added RIPEMD160withECDSA signature algorithm.
Added support for notation data signature subpackets to OpenPGP.
Added support for parsing of experimental signatures to OpenPGP.
Added the complete set of SEC-2 EC curves.
Added support for implicit tagging to DerApplicationSpecific.
Added remaining ASN.1 structures from RFC 3126 to Asn1.Esf namespace.
Performance of ECDSA improved.
Performance of ASN.1 stream parsing improved.
Fixed default private key length for Diffie-Hellman parameters.
Fixed DerT61String to correctly support 8-bit characters.
Fixed duplicate attribute problem in Pkcs12Store.Save.
Fixed a problem writing public keys in OpenPGP [#BMA-5].

#### Release 1.1, Friday May 4, 2007

Added support for writing DSA private keys, and more encodings, in OpenSsl (PemReader/PemWriter).
Removed SharpZipLib dependency.
Added RSA blinded signature classes.
Added Asn1.IsisMtt namespace (ISIS-MTT ASN.1 classes).
Added SEED block cipher engine.
Added Salsa20 stream cipher engine.
Performance optimisations for F2m elliptic curves.
Fixed OpenPGP bug decrypting files with multiple types of encryption on the session key.

#### Release 1.0, Thursday January 18, 2007

Implementations of CMS, OCSP, OpenPGP, and TSP.
Elliptic Curves (F2m and Fp).
A basic TLS client.
PEM file reading and writing.
Symmetric key algorithms: Camellia, GOST28147, NaccacheStern, and TEA/XTEA.
Symmetric key modes: GOFB and OpenPGPCFB.
Symmetric key paddings: ISO7816d4.
Asymmetric key algorithms: RSA blinding.
Digests: GOST3411 and Whirlpool.
Macs: GOST28147 and ISO9797 Alg 3.
Signer mechanisms: ECDSA, ECGOST3410, and GOST3410.
...and many more features, bug fixes, and performance improvements.

#### Tuesday Febuary 1, 2005

This is the second beta release of the Bouncy Castle API C# implementation.
Reliability improvement to ASN1InputStream.
The OID entries in SignerUtilities for RSA signature algorithms for SHA-256,
SHA-384, and SHA-512 were pointing creating the wrong signature objects.

#### Sunday December 12, 2004

This is the first beta release of the Bouncy Castle Cryptographic API C# implementation.
The Legion of the Bouncy Castle would like to extend their thanks to all those who contributed to this API during the alpha stages of its development.
Keep up the good work folks.
Please send any questions or bug reports to dev-crypto-csharp@bouncycastle.org

### Trademarks.

C#, .NET, and MSDN are Registered Trademarks of Microsoft. Microsoft.com
Java is a Registered Trademark of Sun Microsystems. Sun Microsystems
© 2007 Legion of the Bouncy Castle