Questions tagged [bouncycastle]

Bouncy Castle is a cryptography API providing various cryptography, encryption, and security protocols. There are fairly similar libraries in both C# and Java that implement the API. Additionally, Bouncy Castle provides a JCE-compliant crypto provider for Java.

  • 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 2440)
  • 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.
3108 questions
1
vote
1 answer

Correctly handle OCSP requests from C# / Java app (+ BouncyCastle)

I have an application (dotnet core with Bouncy Castle) that generates X509 certificates. Essential part of certificate management is also revoking them. I do support revoking by CRL currently, but there was a requirement from our vendor to implement…
Piotr Dabrowski
  • 568
  • 6
  • 17
1
vote
1 answer

Trust chain working on Windows but not with Firefox and macOS

We have an intranet application under Windows Server with its own CA. The root (CA) certificate is already installed on all clients /Windows and macOS). The existing server certificate no longer meets Apple's current requirements (e.g. 2-year term…
Tinus
  • 31
  • 4
1
vote
0 answers

Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

With very little knowledge of SSL and related security technologies now we have to send requests to a resource using mentioned stuff: However, whenever we try to do so, we get the following exception: Exception in thread "main"…
J Doe
  • 11
  • 1
1
vote
1 answer

How do I use scrypt to encrypt a private key with a password

how do I encrypt a private key created using the KeyPairGenerator in java with scrypt? I want to secure the private key using a password, so no one can use the private key to decrypt the data I encrypted even if he has the private key and the…
Nightloewe
  • 918
  • 1
  • 14
  • 24
1
vote
0 answers

Bad padding in McEliece impementation

I am trying to implement the McEliece algorithm and I am having some troubles. When I try to decrypt a message, it shows an exception saying that the ciphertext is invalid. I am using BouncyCastle implementation as a guide for my work. GitHub page…
1
vote
0 answers

C# Verify Sign Data with Bouncy Castle

I am trying to sign and verify the singed data in C# using Bouncy Castle. I went through almost everything I found on google but it does not seem to solve my problem. Please have a look at my approach. public class Crypto2 { private static…
1
vote
1 answer

Java to ASN1 readable string

We are working on a project in which I need to play with ASN1. An we decided to use BC to to that. There is a complex ASN1 definition file that I have to work with and so far so good, I am able to create my classes and use BC to do my sets,…
maxime chevry
  • 71
  • 1
  • 3
1
vote
1 answer

Need to be able to get same signature from C# (dotnet-core) code as openssl rsautl -sign -inkey

For the communication between a c# dotnet-core application (windows and linux) and Chef.io API I need to be able to create the same signature within c# dotnet core as this call of openssl executable: openssl rsautl -in encryption.txt -sign -inkey…
TvG71
  • 21
  • 3
1
vote
1 answer

how to initialize a bouncycastle BigInteger?

the hex string is correctly parsed into bytes, its values are [0]0xf4, 10xd0,[2]0x93,[3]0xb2...... i used the bytes to initialize a bouncycastle BigInteger. i expect its magnitude value is [0]0xf4d093b2, ....... what is the right method to…
1
vote
1 answer

how to enable TLSv1.2 on java 6 (TLSv1.2 + Bouncycastle + Java 1.6_45)

My application is currently running on java 1.6_45 and OSGI 3.2. I should adapt TLSv1.2, because the server supports only TLSv1.2 from now. I still get bad_record_mac error. Can anyone help me? I tried the following**** // Installiere Bouncy…
engnbln
  • 31
  • 1
  • 5
1
vote
0 answers

PGP Encryption causes program to crash after Multiple File Encryptions

I have followed the code in here to build a console application which encrypt multiple files at once. With the application I am encrypting bulk amount of files (Max I tried is 4). What I noticed is after 2nd or 3rd file encryption, the program…
hiFI
  • 1,887
  • 3
  • 28
  • 57
1
vote
1 answer

bouncy castle PGPObjectFactory nextObject returns null

I am trying to decrypt and encrypt a message with RSA public and private keys. When I try to read PGPObjectFactory.nextObject() i get null below is my code. Security.addProvider(new BouncyCastleProvider()); InputStream in =…
Rookie007
  • 1,229
  • 2
  • 18
  • 50
1
vote
1 answer

How to Convert DSA Certificate to RSA Certificate?

I'm working regarding the development of a Keystore software in java and scala. Now I have a tool to manage my public key certificates. But it only supports the RSA type certificates, not the DSA type. I want to convert DSA type certificates to RSA…
1
vote
1 answer

Construct x509 encoded public key from algorithm oid and byte[] value of key

I have algorithm oid and byte array with public key value. I need to encode it as asn1 defined in the X.509 standard: SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, subjectPublicKey BIT STRING } How can I do this, except…
Dmitry
  • 864
  • 7
  • 15
1
vote
1 answer

Equivalent of CBCBlockCipherMac from bouncycastle for swift

I need to re-implement for iOS (swift) a cryptographic operation done for an Android app (kotlin) thanks to bouncycastle's lbrary. The kotlin code is : val mac = "9D3391051A4E774B".hexStringToByteArray() val macKey =…
brice cesarin
  • 105
  • 2
  • 7