Git Product home page Git Product logo

Comments (3)

Sloy avatar Sloy commented on May 20, 2024

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.

kjur avatar kjur commented on May 20, 2024

I've fixed it today on version 4.2.3. Thanks.

from jsrsasign.

animalillo avatar animalillo commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.