Comments (3)
@BlueMeanie has this 'issue' been resolved? It looks like it was a question about implementation and not a bug/issue. Please consider to close it. Thanks.
from jsrsasign.
@kjur this question should be closed due to lack of response from originator
from jsrsasign.
To share key between Java and jsrsasign, I would recommend to share them in PKCS#8 DER private and public key format.
For example "prv.p8p.der" is a PKCS#8 DER formatted binary plain EC private key file and
"pub.p8.der" is a PKCS#8 DER formatted binary EC public key file.
Then to load private key in Java:
byte[] prvKeyBytes = loadBytes("../prv.p8p.der");
KeyFactory kf = KeyFactory.getInstance("EC");
KeySpec keySpec = new PKCS8EncodedKeySpec(prvKeyBytes);
PrivateKey prvKey = kf.generatePrivate(keySpec);
To load public key in Java:
byte[] pubKeyBytes = loadBytes("../pub.p8.der");
KeyFactory kf = KeyFactory.getInstance("EC");
KeySpec keySpec = new X509EncodedKeySpec(certBytes);
PublicKey pubKey = kf.generatePublic(keySpec);
To load private key in JavaScript with jsrsasign:
rs = require("jsrsasign");
rsu = require("jsrsasign-util");
hPrv = rsu.readFileHexBin("prv.p8p.der");
prvkey = rs.KEYUTIL.getKey(hPrv, "pkcs8rv");
To load public key in JavaScript with jsrsasign:
rs = require("jsrsasign");
rsu = require("jsrsasign-util");
hPub = rsu.readFileHexBin("pub.p8.der");
pubkey = rs.KEYUTIL.getKey(hPub, "pkcs8pub");
from jsrsasign.
Related Issues (20)
- ECDSA signature is different with same private key and same message HOT 1
- Encryption and decryption errors occur repeatedly HOT 15
- Does this component support ECDH key negotiation? HOT 3
- Private certs included in the NPM package. HOT 1
- Lax JWK Decoding Issue HOT 2
- KJUR.jws.JWS.sign is very slow. HOT 3
- Property 'jws' does not exist on type 'typeof jsrsasign' HOT 3
- jsrsasign vulnerable to the Marvin Attack HOT 3
- crypto-js PBKDF2 vulnerability HOT 2
- Wechat mini program SHA1withRSA signature function is very slow HOT 1
- Uncaught Syntax Error HOT 1
- Can't verify valid ECDSA singature HOT 7
- OpenSSL "Verification failure" with jsrsasign Signature HOT 1
- KEYUTIL.getKey() fails because KJUR.crypto.Cipher is undefined HOT 3
- Generating a CSR with RSA as algorithm does not work with sample script HOT 1
- The CSR API sample is not working. Throws TypeError: rs.KJUR.asn1.x509.CertificationRequest is not a constructor at Object.<anonymous> HOT 2
- Will new version support RSA and RSAOAEP encryption? HOT 1
- X509 getExtBasicConstraints() not outputting the CA JSON key and value HOT 10
- X509 method getExtKeyUsage() not returning the critical flag value HOT 6
- [Question] Does this package work in Expo (React Native) applications? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsrsasign.