bouncycastle

How to reconstruct 33-byte compressed NIST P-256 public key from 33 bytes?

十年热恋 提交于 2019-12-12 01:16:38
问题 Supposed that the 33 bytes encoded Public Key can be created like this: Security.addProvider(provider) val generator = KeyPairGenerator.getInstance("ECDSA") val ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1") generator.initialize(ecSpec) val keyPair = generator.generateKeyPair() val privateKey = keyPair.private as ECPrivateKey val publicKey = keyPair.public as ECPublicKey val publicEncoded = publicKey.q.getEncoded(true) How can I reconstruct it again on the other side (when I am

how to sign an end entity certeficate by a ca cert using a given private key

99封情书 提交于 2019-12-11 23:18:00
问题 I have coded in java (using bouncy castle library)my CA certificate. and now I want to sign an end entity certificate with a given private key. here is my code : X500Principal dnNameIssuer = new X500Principal("CN=\"" + hashedValue + " CA\", OU=PKI, O=\"" + hashedValue + ", Inc\", L=Darmstadt, ST=Hessen, C=DE"); X500Principal dnNameSubject = dnName; serialNumber = new BigInteger("123127956789") ; keyus = new KeyUsage(KeyUsage.digitalSignature); ContentSigner signer = new

java.io.IOException: Can't process class when running ProGuard in Maven build of Android project

99封情书 提交于 2019-12-11 22:01:54
问题 I use a library called iText to write new information to existing PDFs. In order to encrypt PDFs, iText (for Android) uses a library called SpongyCastle which is an Android port of BouncyCastle. Unfortunately, both iText and Spongycastle contain a very large number of methods (15k+). In Android there is a hard limit to the number of methods you can use (64k). Fortunately, iText does not use many classes in the Spongycastle jar. I was able to unzip the Spongycastle jar and remove all of the

Sign MimeBodyPart which has attachments in it (with Bouncycastle)

妖精的绣舞 提交于 2019-12-11 19:41:25
问题 I am working with OpenAS2Server-1.3.3 library. There sending a single document is working fine.. Now I wanted to modify it to send document with attachments, like we do with emails. In this scenario, all the decription work well, but signature verification failed (MIC is not matched) This is how I am tring to send attachments with main doc: Create a MimeMultipart and add two MimeBodyPart into it. (main document and the attachment) Finally wrap the MimeMultipart within a MimeBodyPart (I am not

class file for org.bouncycastle.cert.ocsp.BasicOCSPResp not found

Deadly 提交于 2019-12-11 19:26:00
问题 I made the mistake of running clean on my Netbeans project, which has had no major API changes at all lately. Now the build suddenly fails with the following error: class file for org.bouncycastle.cert.ocsp.BasicOCSPResp not found To my knowledge, I'm not using any such library in my project. I did find that it is an iText dependency of some sort, but even when I comment out all of my iText-related code, the error persists. I have tried adding the 1.49 version of bouncycastle to my Netbeans

C# - ecc-certificate requested with BouncyCastle seems to be invalid in .NET

Deadly 提交于 2019-12-11 17:52:43
问题 As it turned out in the comments to this SO-question the source of the problem lies elsewhere so I decided to ask a new question. I request a certificate from our PKI for a ecc keypair (curve is brainpoolP384r1). This is done via registration authority that does the proof of possession. After that I attach the private key to the issued certificate using some of the code in this helpful questions/answers: generate-certificate-using-ecdsa-in-c-sharp and translating-elliptic-curve-parameters-bc

Using BCPG public key in ObjectivePGP for generating PGPKey its return nil

被刻印的时光 ゝ 提交于 2019-12-11 17:25:08
问题 My Public key : -----BEGIN PGP SIGNATURE----- Version: BCPG v1.48 lQH+BFomf0kDBADUrV1KFuGFxvRhA7yCO07q5vtvKTjnP4wRn5KyXMyjYX2R5rvGkQkpWwBfzGCxMA+ieeW5mWFrNFod4A6wXGzXiiEZ3/i4EfvyipKk38sLVdW8I3sux1lnjp4t+6p1RTAVAwx0yWGjNHlLcbwhtFNyoIW1fxUckVZwW3PJrJm2owARAQAB/gMDAkpUpa7K3etCYNSXyy/c0CfQ1fMVnWtls9UNiLyj8Hi3qyaBK0E942xZQkiq60qCirnPtWTsndKkMnHuGcOVSusYwP20aKj2Z4vrfKAtSx1CoJVPtk0M/qt/cbUQqpkFrow6RBxCI5k/6xaxK+174WtEQRSD/Dzr99jPBdbI8zYB/1Nzj7uFZPci0i8x04TzR8aSFx5vTXc9v5nSEYUoNd

parsing ASN files using bouncy castle

余生颓废 提交于 2019-12-11 16:11:57
问题 am trying to parse binary CDRs using JASN1 I have successfully generated Java classes using grammer file not I have a CDR which I need to decode, but I can't get it to work, I don't understand what kind of inputs it requires I have reached a point where I can parse CDR into lines like below [1][[0]#01, [1]#26fd, [3]#4131002400, [8]#14040020236233, [9]#21436500000041, [10]#196105000045ffffffffffff, [13]#13900049999957, [14]#21436549999961, [15]#05, [16]#05, [17]#116102999954ffffffffffff, [22]

Create ASN.1 from two big integers

别说谁变了你拦得住时间么 提交于 2019-12-11 15:16:55
问题 I have a java program using an HSM that with the native API gives me and R and S value of an ECDSA signature which is just the two Big Integers. I need to take those Integers and create ASN.1 encoding. Any idea on how I could do that? I do have BouncyCastle up and running but, I am not familiar with the options available to me. 回答1: A small example to illustrate: import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERSequence; import javax.xml.bind.DatatypeConverter; import

AuthenticatAsClient fails with CRYPT_E_ASN1_BADTAG

与世无争的帅哥 提交于 2019-12-11 14:55:29
问题 I have written a .NET application that tries to do mutual authentication with an ECC client certificate (curve is brainpoolP384r1). The certificate is signed by a PKI and when I look at it in an ASN1 viewer it seems to be perfectly valid. I get the certificate byte data for this the following way: Console.WriteLine($"Certificate:{BitConverter.ToString(cert.RawData).Replace("-","")}"); Looking at the certificate in the MMC console it also appears to be valid. However, when I try to use it to