bouncycastle

What is the default signature algorithm of bouncycastle CMSSignedDataGenerator if not explicitly specified

拥有回忆 提交于 2019-12-06 12:11:13
问题 I was wondering what signature algorithm (digestOID) BouncyCastle uses by default if you do not specify it explicitly like like in the code below: List certList = new ArrayList(); CMSTypedData msg = new CMSProcessableByteArray("Hello world!".getBytes()); certList.add(signCert); Store certs = new JcaCertStore(certList); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(signKP.getPrivate());

BouncyCastle J2ME RSA using custom keys

社会主义新天地 提交于 2019-12-06 12:04:08
I would like to use BouncyCastle J2ME/RIM Crypto in my Blackberry Application. The issue i'm having is that I would like to generate the public key for encryption from a C#.NET program that sends the key to the BlackBerry. Is it possible to encrypt a message using a raw string? Also, do I need to know other common variable such as modulo etc? Apologies but i'm completely new to cryptography algorithms. Do I need BouncyCastle for this or can the above be done with RIM Crypto? Thanks, Conor I did it using bouncycastle, but with RIM Crypto is similar. Follow the example. As you can see the keys

Android - SSL/TLS and ECC (Elliptic curve cryptography)

限于喜欢 提交于 2019-12-06 11:07:35
问题 I'm developing an android application which communicates with a web server. We use HTTPS for this communication and we have also a client certificate inside the android application for authentication. We created SSL certificates using ECC (ANSI x9.62) in order to have very small certificates so we can reduce the transmission cost during handshake. The source code for the communication is more or less like this: InputStream keystoreIs = getResources().openRawResource(R.raw.client_bks);

Parent Last Classloader to solve Java Class path hell?

佐手、 提交于 2019-12-06 10:31:33
问题 I have a project which uses two versions of bouncyCastle jars bcprov-jdk15 and bcprov-jdk16. The jvm loads the older version but there is a feature I wrote which needs the newer version to run. I tried to solve this classpath hell by using a custom class loader. After some googling and with the help of some previous Stackoverflow answers[1] [2] and this blog, I wrote the following Parent Last Class loader to load the classes from the newer jar before delegating to the parent class loader.

Bouncy Castle not working on linux machine

混江龙づ霸主 提交于 2019-12-06 10:17:17
I implemented boucnyCastle for fips complaint signature generation and verification, this worked fine on a windows environment but on a linux environment the code is stuck on keypair generation. Following is the code that i have written: public static KeyPair generateKeyPair() throws GeneralSecurityException { KeyPairGenerator keyPair = KeyPairGenerator.getInstance("RSA", "BCFIPS"); keyPair.initialize(new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4)); return keyPair.generateKeyPair(); } Bouncy Castle First Check if rngd.service (Hardware RNG Entropy Gatherer Daemon) is running on

How to sign signature data using bouncy castle?

a 夏天 提交于 2019-12-06 09:43:14
问题 **This is my code to sign a String.</br>** package my.package; import java.io.FileInputStream; import java.security.Key; import java.security.KeyStore; import java.security.PrivateKey; import java.security.Security; import java.security.Signature; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; import org.bouncycastle.cert.jcajce.JcaCertStore; import org.bouncycastle.cms.CMSProcessableByteArray; import org.bouncycastle.cms.CMSSignedData; import

NoSuchAlgorithmException PBEWITHSHA256AND128BITAES

混江龙づ霸主 提交于 2019-12-06 09:13:39
问题 I'm working on a Java cross-platform client application that would use PBEWITHSHA256AND128BITAES-CBC-BC from Bouncy Castle API encryption to store sensitive information in local files. The following code : public static void main(String[] args) throws NoSuchAlgorithmException { Security.addProvider(new BouncyCastleProvider()); for (Provider provider : Security.getProviders()) { for (Provider.Service service : provider.getServices()) { System.out.println(provider.getName() + ": " + service

Java byte array to ECCPrivateKey - InvalidKeySpecException: encoded key spec not recognised

一世执手 提交于 2019-12-06 09:05:32
When I try to make ECC private key from byte array, I get exception mentioned below. I have public/private keys and out signed output from C library micro-ecc/uECC.h. C used secp192r1 curve. I am trying to verify data with C generated keys in Java. How to convert byte array to private/public key? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] kb = new byte[]{(byte)0x24, (byte)0xF4, (byte)0x36, (byte)0x16, (byte)0xD0, (byte)0x96, (byte)0x12, (byte)0x63, (byte)0x90, (byte)0x2E, (byte)0x51, (byte)0xF6, (byte)0x87, (byte)0x55, (byte)0xAB, (byte)0xCB, (byte

Getting BouncyCastle to decrypt a GPG-encrypted message

爱⌒轻易说出口 提交于 2019-12-06 08:27:20
问题 How can I get BouncyCastle to decrypt a GPG-encrypted message? I have created a GPG key pair at the CentOS 7 command line using gpg --gen-key . I chose RSA RSA as the encryption types, and I exported the keys using gpg --export-secret-key -a "User Name" > /home/username/username_private.key and gpg --armor --export 66677FC6 > /home/username/username_pubkey.asc I am able to import username_pubkey.asc into a remote Thunderbird client of another email account and successfully send an encrypted

how to load the private key from a .der file into java private key object

社会主义新天地 提交于 2019-12-06 08:08:56
I'm writing a java program to import private keys from files within the file system and make a private key object, using java... I could do it for files in .pem format but, with .der format, I had no idea what to do, since I couldnt firstly detect the algorithm used to generate the keys. within .pem files I could determine the algorithm from the header for PKCS#1 which have a header like -----BEGIN RSA PRIVATE KEY---- formats and used the bouncycastle pem reader for those in PKCS#8 which have a header -----BEGIN PRIVATE KEY----- but with those in .der format no idea :( also if anyone have an