bouncycastle

RSA encrypt using jsencrypt and decrypt using bouncy castle?

折月煮酒 提交于 2019-12-24 01:45:47
问题 Right I've a small problem. I'm using a Javascript library (jsencrypt) to encrypt a message in a browser. This message is then sent to the backend where it is decrypted using a Java library (bouncycastle). My problem is although I can encrypt and decrypt messages using both libraries they don't seem to want to work together. So when I encrypt my message in a browser and send it to the backend I end up getting garbled gibberish. Does anyone have any idea what's going on here? JSENCRYPT var

convert PEM encoded RSA public key to AsymmetricKeyParameter

丶灬走出姿态 提交于 2019-12-24 00:50:25
问题 I am trying o create a method that constructs an AsymmetricKeyParameter from a PEM encoded public key. Unfortunately, pemReader.ReadObject() return null. Here's a working solution for a private key: convert PEM encoded RSA private key to AsymmetricKeyParameter What is wrong with this method? static AsymmetricKeyParameter ReadPublicKeyFromPemEncodedString(string pemEncodedKey) { AsymmetricKeyParameter result = null; using (var stringReader = new StringReader(pemEncodedKey)) { var pemReader =

Bouncy castle security provider doesn't load under Java 11/12

拈花ヽ惹草 提交于 2019-12-23 20:15:15
问题 I'm trying to do something that's supposed to be trivial but there is a problem that I'm facing. The bouncy castle security provider won't load when after migrating a JavaFx application from Java 8 to Java 11 (tried Java 12 as well, same results). It's a Maven project that I updated to use Java 11 compliant plugins. It compiles fine but when running I get this in the terminal window: jar .Launcher java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect

Bouncy Castle ECDSA Create Public Key from Private Key

谁说我不能喝 提交于 2019-12-23 18:18:50
问题 I am trying to sign a bitcoin transaction in c#. I have 2 bits of code I am trying to complete. I can create a set of private and public keys using Bouncy castle. I can convert this to wallet import format ok. I can also generate a bitcoin address from the ECDSA public key. However, I want to sign a transaction and all I have is my private key. I don't want to have to import into a wallet and sign. So how can I generate the public key, given only the private key? I have found a javascript

Unlimited Strength Jce and Android

痞子三分冷 提交于 2019-12-23 17:48:17
问题 I'm using SpongyCastle (full implementation of BouncyCastle's crypto functions for Android) and I have a bks that contains a key of size 384. I'm trying to extract that key using the method KeyStore.getKey(alias, password) as you would any key in a keystore. But what I'm running into is the error java.security.UnrecoverableKeyException: no match . Doing a little bit of research indicates that it might be because the key size is too big for Android to handle which makes sense as my program

Getting root and intermediate certificates from an end-entity

£可爱£侵袭症+ 提交于 2019-12-23 12:27:02
问题 still being a noob in cryptography I stumble upon simple things every day. And today is just one of those days. I want to validate smime messages in java with the bouncy castle library, and I think I almost figured it out, but the problem at this moment is the building of the PKIXparameters object. Let's say, I have an end-entity x509certificate with the following structure: root certificate +->intermediate certificate +->end-entity certificate In order to validate message I need to build a

What's the best way to integrate the Bouncy Castle provider in a Java program?

女生的网名这么多〃 提交于 2019-12-23 07:28:29
问题 What's the best way to integrate the Bouncy Castle provider in a Java program? I know I can add it programmatically, by using: import org.bouncycastle.jce.provider.BouncyCastleProvider; ... Security.addProvider(new BouncyCastleProvider()); Or either I can add it to a path in the JRE on my machine. What's the best choice? 回答1: In my opinion the adding it as security provider with own code is the best option. This is because it is only project dependent - not system dependent. Add the

Where is the Bouncy Castle API documentation?

随声附和 提交于 2019-12-23 06:55:23
问题 I need to do some cryptography based work, and I have found out Bouncy Castle API which is both available for C# and Java, for Java it has documentation, but it has no documentation for C#. Can anyone provide me some resources from where I can get idea for using Bouncy Castle with C#? 回答1: I also couldn't find any C#-documentation for Bouncy Castle API. Seems, like it doesn't exist. But you can go this way. Download library sources, and look at them a little. Code actually looks like Java

sign the large message and verify with recover message

℡╲_俬逩灬. 提交于 2019-12-23 05:36:05
问题 I write the following code for signing the message and then verify it, in java by Bouncy Castle. signing work properly but verifying don't work completely. Verifying with short input message work properly but with large input message (larger than 106) don't work properly. In other words when the length of input text for sign becomes large, the verify can not do complete. the result of code print: signature tampered and return partial of the primary message. public static String sigVer

Is it possible to do use GCM with BC on JDK 1.7?

拜拜、爱过 提交于 2019-12-23 05:22:56
问题 I'm trying to do a TLS connection using any of the AES GCM variants and from what I understand in the docs this should be possible but I get this error: Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1989) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java