bouncycastle

Encrypt Data with C# AesCryptoServiceProvider crypted with BouncyCastle AesFastEngine

Hello, I need to decrypt Data with Standard C# AesCryptoServiceProvider which was encrypted with Bouncy Castle AesFastEngine on the Java side. (To decrypt the Data using the c# implementation of Bounca Castle is no problem) Is there a way to do this? I don't find the IV used in the Bouncy Castle implementation... Is there any? Any he...

Verifying PKCS#7 certificates in Java

Hello everyone. Need some help with crypto routines in Java. Given a PKCS#7 signature, I want to verify all certificates it contains against a trusted store. I assume that all certificates contained in signature are in the correct order to form a valid certificate path (or chain, whatever), so that topmost (#0) is a signing certificat...

Signing a string with RSA private key on .NET?

byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("AAAAAAAAAAAAA"); TextReader trCer = new StreamReader(@"AA.key"); //key in PEM format PemReader rdCer = new PemReader(trCer); AsymmetricCipherKeyPair o = rdCer.ReadObject() as AsymmetricCipherKeyPair; ISigner sig = SignerUtilities.GetSigner("MD5WithRSAEncryption"); sig.Init(true,...

Add a KeyUsage extension on a Bouncycastle certificate request

Hello. Could anyone post a Java code for adding to a PKCS10 bouncycastle certificate request an extension regarding a KeyUsage (for example a KeyUsage.keyEncipherment). I didn't find anything ad i cannot find a proper contructor for X509Extension with a KeyUsage. Thanks ...

PBKDF2 in Bouncy Castle C#

I've being messing around the C# Bouncy Castle API to find how to do a PBKDF2 key derivation. I am really clueless right now. I tried reading through the Pkcs5S2ParametersGenerator.cs and PBKDF2Params.cs files but i really cant figure out how to do it. According to the research I have done so far, PBKDF2 requires a string (or char[]) ...

Streaming api for reading/writing certification revocation list in java

Hi, My project has a module which generates crl for revoked x509 certificates. However, the crl generation api provided by bouncy castle is fully 'memory' dependent and I don't think it will scale after some point in time. I also know that crl can be generated as deltas or in partitions. But is there an api which can generate crl witho...

Get Private Key from BouncyCastle X509 Certificate? C#

Normally when I grab an X509Certificate2 out of my keystore I can call .PrivateKey to retrieve the cert's private key as an AsymmetricAlgorithm. However I have decided to use Bouncy Castle and its instance of X509Certificate only has a getPublicKey(); I cannot see a way to get the private key out of the cert. Any ideas? I get the an X50...

BouncyCastle create AsymmetricCipherKeyPair from existing keys?

I have two AssymetricAlgorithm RSA keys that I have pulled out of a certificate that was in my keystore. One is the Public Key and the other the Private. Is there a way of getting this keypair into a BouncyCastle AsymmetricCipherKeyPair? BouncyCastle's AsymmetricCipherKeyPair expects a public and private AsymmetricKeyParameter however I ...

BouncyCastle create PKCS 7 Encrypted File? C#

I am trying to use BouncyCastle to encrypt a file using the PKCS 7 file standard. Here is the code I have which outputs a p7m file. When I go to decrypt the file (using Entrust) I am prompted for my key store password, so it knows the file was encrypted for me using AES 128, but it cannot decrypt the body of the file. Something has to be...

Recommended solutions to use PGP-compatible file encryption from a Java app running on Linux?

I need to replace an existing application that, among other things, will need to encrypt/decrypt/sign messages and files in a manner compatible with PGP Desktop. The new application is written in Java (JDK 1.6) and will run on Linux. After surveying what's available, I see BouncyCastle (http://www.bouncycastle.org/java.html) supports ...

What algorithm does PGP use to encrypt the private key using the passphrase?

The PGPKeyRingGenerator constructor takes in a passphrase to encrypt the private key. What is the algorithm that it uses to do this? It has a field called encAlgorithm, but I couldn't find any documentation explaining what these algorithms are. ...

get certificate detail from Public key?

Hi, is there any way to get certificate detail from Public key... i had use bouncy castle jar for this but some how i cant better help to solve this problem. please help me out urgently... ...

want to read issuer String from users public key

Hi, I want to read issuer String from users public key with bouncy castle... is there any one have some code or something from which i can get help... ...

Java - Sending certificate through socket

Hi, i need to send a v3certificate from the server to the client using socket. To do this: server side, i generate a certificate which i encode with base64.encode , then i send it to the client. Client side, i receive the string which contain the certificate, Server code: X509Certificate certificate = ...; sendAnswer(new String(certi...

Secret keys differ between Android and server

I'm working on a one-time password application, using the hotp algorithm (RFC 4226). I've got an Android app (via simulator) for otp generation, and a server-side app for validation. On their own, both are working fine and passing tests. However, the secret key I'm generating on my device is not the same as the secret key I'm generati...

Documentation for Bouncy Castle AES 256 encryption in .Net?

I'm trying to implement the Bouncy Castle encryption library in a .Net project, but am not finding a lot of .Net-related documentation. The class/method structure isn't even close to the ample Java-related examples. Does anyone have some good .Net examples for this? Thanks. ...

Looking for a model explaining the internal structure of a PGP-signed & encrypted file

I'm trying to debug & extend an existing piece of Java code using BouncyCastle to decrypt and verify secured attachments. I've looked through the BouncyCastle samples but what it's harder to extract from there is a model of what a PGP-secured attachments looks like. From the code and various errors I can infer there is something repres...

Convert a PKCS#8 private key to PEM in java

Hello everyone I'm trying to convert a PKCS#8 private key that I generate in my java program to a PEM encoded file. Security.addProvider(new BouncyCastleProvider()); SecureRandom rand = new SecureRandom(); JDKKeyPairGenerator.RSA keyPairGen = new JDKKeyPairGenerator.RSA(); keyPairGen.initialize(2048, rand); KeyPair keyPair = ke...

Inserting Certificate (with privatekey) in Root, LocalMachine certificate store fails in .NET 4

Hi, I'm having problems inserting a new CA certificate with privatekey in the Root certificate store of the localmachine. This is what happens: //This doesn't help either. new StorePermission (PermissionState.Unrestricted) { Flags = StorePermissionFlags.AddToStore }.Assert(); var store = new X509Store(StoreName.Root, StoreLocation.Lo...

BouncyCastle Decryption works, but not Encryption?

I'm getting an encrypted string from an external service that I need to decrypt, and then re-encrypt using the BouncyCastle API. I've managed to get decryption working fine, but encryption doesn't seem to work. When I try to decrypt a string generated by my encryption method I get an InvalidCipherTextException with the message "unknown ...