bouncycastle

How must I format IP Address for SubjectAlternativeName in X509 certificate created by BouncyCastle?

◇◆丶佛笑我妖孽 提交于 2019-12-11 03:05:42
问题 I use BouncyCastle to generate certificats. Now I want to add some SubjectAlternativeName , just like: ... ArrayList namesList = new ArrayList(); namesList.add(new GeneralName(GeneralName.dNSName, "*.test")); namesList.add(new GeneralName(GeneralName.iPAddress, "127.0.0.1")); namesList.add(new GeneralName(GeneralName.rfc822Name, "zoltar@spkac.spectra.org")); GeneralNames subjectAltNames = new GeneralNames(new DERSequence((GeneralName[])namesList.toArray(new GeneralName [] {}))); new_cert

AES-256 encryption workflow in scala with bouncy castle: salt and IV usage and transfer/storage

帅比萌擦擦* 提交于 2019-12-11 02:59:40
问题 I'm trying to implement secure encryption of the files to be sent over insecure channel or stored in an insecure place. I use bouncy castle framework, my code is written in scala. I decided to use aes-256 (to be more specific - Rinjael with 256 bit block size, here is why). And it seems like I can use Rinjael with any (128|160|192|256) block length. I cannot understand the whole process overview correctly. Here is one of good answers, in this question there is some useful code specific to

Encrypt a private key with Password using BouncyCastle

99封情书 提交于 2019-12-11 02:08:27
问题 I am new to BouncyCastle. I have a private key generated using the below code. final CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null); keypair.generate(1024); final PrivateKey privKey = keypair.getPrivateKey(); I would to encrypt it with a password using AES or some openssl supported algorithm using BouncyCastle. Can some one help me out how to start, where I am not able to find any good tutorial on this. Please help me out. Thanks in advance. 回答1: If you just want to

Signing X509 Certs w/BouncyCastle - invalid digital signature [duplicate]

天大地大妈咪最大 提交于 2019-12-11 01:07:51
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: Generated signed X.509 client certificate is invalid (no certificate chain to its CA) I followed the example at: http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation But the resulting signed client certificate has the following error when opened in windows: "This file is invalid for use as the following: Security Certificate" If I install it anyway and

Store PKCS#12 Container (pfx) with Bouncycastle

假装没事ソ 提交于 2019-12-11 00:21:56
问题 I am struggling with the creation of a pfx file with Xamarin and BouncyCastle. I have the following settings/ specification .NET: PCL .Net Framework 4.5.1 Xamarin: 4.5.0.476 BouncyCastle: BouncyCastle-Signed 1.7.0.1 (NuGet Package) I want to generate a Self-Signed Certificate for my mobile client to autheniticate itself against my server. The creation works pretty well using BouncyCastle. My problem is, when I want to store the certificate with its private key as a PKCS#12 (pfx) container and

How do I load an Elliptic Curve PEM encoded Private Key? [duplicate]

吃可爱长大的小学妹 提交于 2019-12-10 22:18:20
问题 This question already has answers here : Reading elliptic curve private key from file with BouncyCastle (3 answers) Closed 2 years ago . I've generated an elliptic curve private/public key pair using OpenSSL. The private and public keys are PEM encoded. I've figured out how to load the public key thanks to this. However, I can't figure out how to load the private key, as the above message just ends up with an InvalidKeySpecException: key spec not recognized. I then found this, but it also

How to construct private key from generated previously ECDSA both encoded key pair?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 21:17:15
问题 Having generated the private key like this: fun getKeyPair(): Pair<ByteArray, ByteArray> { Security.addProvider(provider) val generator = KeyPairGenerator.getInstance("ECDSA") val ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1") generator.initialize(ecSpec) val keyPair = generator.generateKeyPair() val publicKey = keyPair.public as ECPublicKey val privateKey = keyPair.private return Pair(publicKey.q.getEncoded(true), privateKey.getEncoded()) } The public key can be reconstructed again

Email with attachments and images signed with bouncycastle can't be verified by email client

浪尽此生 提交于 2019-12-10 18:49:35
问题 I have a MailComposer that builds a mime message and digitally signs the body part (content) using a MailSigningService . Signing is implemented in the sign() and buildSignedGenerator() methods. After receiving the mail, the mail client detects a signature but complains that the mail may have been tampered. The mail client is able to show the certificate, it shows all certificates (incl the CA). So, either the signing implementation based on Bouncycastle is not done properly or the message

Decrypt Rijndael 256 Block Size with BouncyCastle

拥有回忆 提交于 2019-12-10 18:16:07
问题 We have a helper class for doing encryption that, if I'm going to be honest, was probably copied from Stack Overflow years ago. Currently we're trying to port some of this code to .NET Core and we're finding that it doesn't work because the .NET Core implementation of RijndaelManaged doesn't support a 256 blocksize. From what I've read, it seems like BouncyCastle should still support it, but I can't get it to work. The "unencrypted" text is just a bunch of gibberish. I'm sure I'm doing

AES 256 (instead of 128) with BouncyCastle

≯℡__Kan透↙ 提交于 2019-12-10 16:48:22
问题 I followed much of this post with the objective to implement aes 256 encryption in my software and it works just fine The key point here is that the whole implementation described in the above link uses the AESEngine class . Looking at the class code and javadoc reference, the AESEngine is a 128bit instead of a 256 bit block cipher Searching trough the code and docs i could not find the 192 or 256 bits implementations. Where are them? For completeness, this is the core of my actual ciphering