Welcome to the home page for the Bouncy Castle C# API!
Keeping the Bouncy Castle Project Going
With various algorithm changes, updates, security issues in protocols, and having to write vendor statements for organisations like CERT, keeping the Bouncy Castle project going is turning into a full time job and several of us have now given up permanent work in order to free up time to work on it. If you are making use of our software, and are interested in making sure we are always here when you need us, there are two principal ways you can help.
The first is by getting a support contract or by sponsoring specific work on the project. Not only will you get a hot-line to Bouncy Castle developers, consulting time, and release alerts if you need them, but, if you wish, we will also acknowledge your support publicly. You can find out further information on support contracts and consulting at Crypto Workshop.
Secondly, the Bouncy Castle APIs are now formally owned by a registered Australian Charity, the Legion of the Bouncy Castle Inc, ABN 84 166 338 567. Without considering the costs of actually doing what we do, we're also trying to raise money to allow us to get certifications such as FIPs for the APIs. We can accept donations via PayPal, Bitcoin, or direct transfer. If this sounds more like you, and you want to see this project continue to prosper, please visit our donations page to help. Thanks!
Software produced by this site is covered by the following license and was made possible with the help of the following contributors. If you are interested in sponsoring work on Bouncy Castle or getting commercial support for this or prior releases please contact us at Crypto Workshop.
Release 1.7, 7th April 2011Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, PKCS#12, TSP, and Certificate Path validation.
bccrypto-net-1.7-bin.zip Compiled assembly only.
bccrypto-net-1.7-src.zip Source code, examples, tests, documentation.
bccrypto-net-1.7-bin-ext.zip Compiled assembly only - includes the IDEA encryption algorithm.
bccrypto-net-1.7-src-ext.zip Source code, examples, tests, documentation - includes the IDEA encryption algorithm.
Release Notes for 1.7
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
- See list of resolved issues at Bouncy Castle JIRA C# 1.7
Just want to look at the source? The source code repository is now mirrored on GitHub and accessible from here. The repository can be cloned using either
git clone https://github.com/bcgit/bc-csharp.gitor git protocol
git clone git://github.com/bcgit/bc-csharp.git
CVS Access Note: this is now deprecated
Instructions for anonymous CVS access:
cvs co bc-csharpUsing your favorite CVS client.
Current feature list:
- 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 PBEUtil: 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, 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, DESede, DES, GOST28147, HC-128, HC-256, IDEA, NaccacheStern, RC2, RC4, RC5-32, RC5-64, RC6, Rijndael, Serpent, Skipjack, TEA/XTEA, Twofish, and VMPC.
- 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: RSA (with blinding), ElGamal, DSA, ECDSA.
- Asymmetric key paddings/encodings: ISO9796d1, OAEP, and PKCS#1.
- Digests: GOST3411, MD2, MD4, MD5, RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, Tiger, and Whirlpool.
- Signer mechanisms: DSA, ECDSA, ECGOST3410, GOST3410, ISO9796d2, PSS, RSA.
- Key Agreement: Diffie-Hellman and EC-DH.
- Macs: CBCBlockCipher, CFBBlockCipher, GOST28147, HMac, and ISO9797 Alg. 3.
- 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/SSL Client with support for client side authentication.
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
Keep in touch!
For those who are interested, there are two mailing lists for participation in this project. To subscribe use the links below. (To unsubscribe, replace subscribe with unsubscribe in the message body)
email@example.com with subscribe in the message body. This mailing list is for new release announcements only, general subscribers cannot post to it.
firstname.lastname@example.org with subscribe in the message body. This mailing list is for discussion of development of the package. This includes bugs, comments, requests for enhancements, questions about use or operation.
NOTE:You need to be subscribed to send mail to the above mailing list.
A searchable archive of the dev mailing list is accessible off the mailing lists page.
If you want to provide feedback, offers of jobs (or more importantly beer) directly to the members of The Legion then please use email@example.com
Release 1.6.1, 8th February 2009Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, PKCS#12, TSP, and Certificate Path validation.
bccrypto-net-1.6.1-bin.zip Compiled assembly only.
bccrypto-net-1.6.1-src.zip Source code, examples, tests, documentation.
bccrypto-net-1.6.1-bin-ext.zip Compiled assembly only - includes the IDEA encryption algorithm.
bccrypto-net-1.6.1-src-ext.zip Source code, examples, tests, documentation - includes the IDEA encryption algorithm.
Release Notes for 1.6.1
- 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.
- Problems with the released assembly of the 1.6 version have been rectified.
- 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 188.8.131.52 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.
- See list of resolved issues at Bouncy Castle JIRA C# 1.6
Release 1.5, 18th August 2009Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, PKCS#12, TSP, and Certificate Path validation.
|bccrypto-net-1.5-bin.zip Compiled assembly only.
checksums: md5 d886ecff8ffbb82b8b22dd474e617bf3
|bccrypto-net-1.5-bin-ext.zip Compiled assembly only - includes the IDEA encryption algorithm.
checksums: md5 aa2e0852fd17e8011649cadc14f7ff03
|bccrypto-net-1.5-src.zip Source code, examples, tests, documentation.
checksums: md5 ab43eeeec7dd967db3edb95988838677
- 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.
- 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.
- See also the list of resolved issues at Bouncy Castle JIRA C# 1.5
Release 1.4, 8th August 2008Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, and PKCS#12.
|bccrypto-net-1.4-bin.zip Compiled assembly only - does not include the IDEA encryption algorithm.
checksums: md5 519d136e335502f8b89205e8a1cba6a8
|bccrypto-net-1.4-bin-ext.zip Compiled assembly only - includes the IDEA encryption algorithm.
checksums: md5 622a78d06e50143e108b140f241a116e
|bccrypto-net-1.4-src.zip Source code, examples, tests, documentation.
checksums: md5 d400421918c0c20f2f53fa003e25eb11
- 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.
- 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, 8th December 2007Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, and PKCS#12.
|bccrypto-net-1.3-bin.zip Compiled assembly only.
checksums: md5 41582f69026015d3ec025c1121831576
|bccrypto-net-1.3-src.zip Source code, examples, tests, documentation.
checksums: md5 78f12ded99fadd73bb7cba19ad1c04c8
- 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, 5th July 2007Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, TLS, X.509, and PKCS#12.
|bccrypto-net-1.2-bin.zip Compiled assembly only.
checksums: md5 7141ba8bc67317b71510ee0ab1251abf
|bccrypto-net-1.2-src.zip Source code, examples, tests, documentation.
checksums: md5 bc2bb75a4227f30ba0ff64d40424571c
- 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, 4th May 2007Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, X.509, and PKCS#12.
|bccrypto-net-1.1-bin.zip Compiled assembly only.
checksums: md5 083ed774b70c2d5f39aab47966855b45 sha1 5c0ffa6a661bf28e3eb577a3ea0a2ab69dcbd354
|bccrypto-net-1.1-src.zip Source code, examples, tests, documentation.
checksums: md5 0795d7939b2fd982fc3db3209346135d sha1 3a252c379879ee5fbd389e7134a8aef20b9e74ea
- 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, 19th January 2007Release includes the full lightweight API, as well as APIs for OpenPGP, CMS, X.509, and PKCS#12.
|bccrypto-net-1.0-bin.zip Compiled assembly only (SharpZipLib is required, but not included).
checksums: md5 d1ab2bcfce6fb1b03b9a42a36ee171b0 sha1 3a545c220e79a5b2115bfc4c31a5a805965e4c8f
|bccrypto-net-1.0-src.zip Source code, examples, tests, documentation.
checksums: md5 ab75e0d50fc8dbea84a9297a574b03cf sha1 bd5ca9292615431f2a7c13e071e2191c747301d5
Release 0.0, 13th October 2003
The original C# port: lcrypto-csharp-119.zip - note: the original port is now well out of date, we strongly recommend migrating to the official release stream, apart from anything BigInteger is substantially faster and the new release supports OpenPGP, PKCS#12, CMS, and TSP as well.
Patch, 22 Nov 2004: (Only required for the original C# port) BigInteger.cs Fix to prevent BigInteger prime generation in original port from going into an infinite loop.