Comments (3)
I had the same issue. After struggling with it for an hour or so I found that one requirement in KEYUTIL's code was not being satisfied: keyObjOrHex.isPublic == true
. By printing the prvKeyObj you can see it doesn't have that attribute at all. I added it manually as a workaround and it seems to work:
var keyPair = r.KEYUTIL.generateKeypair("RSA", "512");
keyPair.prvKeyObj.isPrivate = true;
var privateKey = r.KEYUTIL.getPEM(keyPair.prvKeyObj, "PKCS1PRV");
Not sure if it's a bug in generateKeypair or what, but man that was annoying to find.
from jsrsasign.
I've fixed it today on version 4.2.3. Thanks.
from jsrsasign.
bumps
I think this is back in 4.7.1-all-min
var kp = KEYUTIL.generateKeypair("RSA", 1024);
<< undefined
kp
<<Object {prvKeyObj: RSAKey, pubKeyObj: RSAKey}
KEYUTIL.getPEM(kp.prvKeyObj, "PKCS1PRV")
<< Uncaught TypeError: KJUR.asn1.ASN1Util.newObject is not a functionp @ jsrsasign-4.7.1-all-min.js?v=cf866614b6b18cda13fe699a3a65661b:249KEYUTIL.getPEM @ jsrsasign-4.7.1-all-min.js?v=cf866614b6b18cda13fe699a3a65661b:249(anonymous function) @ VM8562:2InjectedScript._evaluateOn @ VM8247:883InjectedScript._evaluateAndWrap @ VM8247:816InjectedScript.evaluate @ VM8247:682
from jsrsasign.
Related Issues (20)
- 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
- verifyJWT error TypeError: Cannot read property 'alg' of undefined HOT 6
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.