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
0 answers

Decrypt RSA Encrypted String with PGP Private Key

I'm having a difficult time getting this to work. I've been given a PGP private key with which to decrypt a file. No problem. That works fine. However, I need to use this same private key to decrypt an encrypted RSA string (encrypted with the same…
mack
  • 2,715
  • 8
  • 40
  • 68
1
vote
0 answers

Java Bouncycastle Generate Ed25519 OpenSSH Private Key File Failing

I've been trying to programatically generate OpenSSH host keys in my Java application, but I'm unable to get a working Ed25519 key in the OpenSSH v1 key format. My current thought is that there's a problem with OpenSSHPrivateKeyUtil, but I'm not…
BPilgrim
  • 54
  • 5
1
vote
0 answers

Issue with java.security.InvalidKeyException: Supplied key (sun.security.mscapi.RSAPrivateKey) is not a RSAPrivateKey instance

Facing issue when getting certificate from windows Keystore. I think system generated certificate/private key is of type sun.security.mscapi.RSAPrivateKey, I need to convert or access it in java.security.interfaces.RSAPrivateKey type. I have seen…
Pratham
  • 11
  • 2
1
vote
1 answer

how to encrypt zip file with p7b certificate and sign it with p12

I have a p7b file which includes the public key the goal is to encrypted a zip file with this public key and change the file to .zip.encrypted and then use a .p12 file to sign the content Questions Right now I'm trying to figure out how this works.…
Hakunama Tatarov
  • 125
  • 1
  • 14
1
vote
1 answer

Bouncy Castle and WebPush: NoSuchMethodError: org.bouncycastle.math.ec.ECCurve$Fp

I'm trying to extend and existing web app (I don't have control of) with a jar extension to add push notification feature. I tried to follow the instructions here: https://github.com/web-push-libs/webpush-java/wiki/Usage-Example But when…
JimBob
  • 156
  • 1
  • 15
1
vote
1 answer

Is it possible to encrypt a regular file using SMIME by bouncycastle in java

I have seen a lot of examples where you can use SMIME to encrypt and email but there is not examples to encrypt a regular file. I have a method where I insert the keys in a bd but I don't know how to use SMIME by bouncycastle to encrypt a…
Allanh
  • 465
  • 1
  • 7
  • 19
1
vote
1 answer

Trying to decrypt a string with public key(not private) using bouncycastle in .net

As a sample app, I encrypted a string using an rsa public key(supplied by a 3rd party api) using BouncyCastle library in .NET. When I send this encrypted string to the said 3rd party api endpoint, it is able to decrypt it(using its private key). I…
SoftwareDveloper
  • 559
  • 1
  • 5
  • 18
1
vote
2 answers

Bouncy Castle Upgrade issue 1.60 and 1.6.1 or higher

We have an issue when upgrading bcprov-jdk15on-160.jar and bctls-jdk15on-160.jar to bcprov-jdk15on-161.jar and bctls-jdk15on-161.jar or higher versions java.lang.InternalError: unable to open random source at …
Kyle
  • 19
  • 3
1
vote
0 answers

Is there a function .net to convert a Json Web Key (JWK) of private key to a ECPrivateKeyParam or a Pem in .net?

I'm trying to convert JWK of a private key which is stored in the session storage of a web application I'm using to a pem. I'm trying to get that and pass it to a function into my .net project. So far I've looked at bouncycastle library but without…
1
vote
1 answer

Handle wrong key store password with bouncy castle

I am loading the key store as follows: try { ks = KeyStore.getInstance("BKS", "BC"); ks.load(ksStream, ksPass); } catch (IOException e) { if (e.getCause() instanceof UnrecoverableKeyException) System.err.println("Wrong password!"); } The…
zomega
  • 1,538
  • 8
  • 26
1
vote
0 answers

Private Key is coming as Null from Keystore Object

Below is my code for getting private key from Keystore file. BouncyCastleProvider provider = new BouncyCastleProvider(); Security.addProvider(provider); System.err.println(KeyStore.getDefaultType()); KeyStore ks =…
Selva
  • 1,620
  • 3
  • 33
  • 63
1
vote
1 answer

Java equivalent of C++ Botan function call

I have a C++ code similar to this: Botan::AutoSeeded_RNG botan_rng; Botan::RSA_PrivateKey private_key(botan_rng, 2048); Botan::PK_Signer botan_pss_signer(private_key, botan_rng, "PSSR_Raw(SHA-256,MGF1,32)"); What I would like to do is to implement…
Vombat
  • 1,156
  • 1
  • 15
  • 27
1
vote
0 answers

Using PBEFileProcessor to decrypt file provided by bouncycastle

I am facing some issue in decrypting a pgp encrypted file. I have the pass phase and the file with me. Now to decrypt it I need to use a class PBEFileProcessor (best guess) provided by bouncycastle in their jar. I have included the jar in my eclipse…
1
vote
0 answers

How to sign email using .p12 in Java?

I tried using bouncy castle but it says digital signature isn't valid/ can't be verified at receiver end. I don't want to encrypt the email, only add digital signature. Please see below code snippet where I'm passing MimeMessage and returning signed…
Gaurav Pingale
  • 424
  • 1
  • 5
  • 11
1
vote
1 answer

Inconsistent Bouncy Castle ECDSA Signing/Verifying behavior on IOS

The Problem: I expect Signing and Verifying Signatures using the same nuget package on different platforms/systems to behave in a similar fashion. However, Signing and Verifying Signatures using BouncyCastle on an IOS system (Simulator and phone…
Aify
  • 3,543
  • 3
  • 24
  • 43