Giter VIP home page Giter VIP logo

Comments (6)

dlongley avatar dlongley commented on July 20, 2024

I only took a quick look, but are you talking about PKCS#1.5 padding support? Because Forge already has this:

https://github.com/digitalbazaar/forge/blob/master/js/rsa.js#L236

I think that's the same padding that Tom Wu's rsa.js file appears to be doing.

from forge.

juliangruber avatar juliangruber commented on July 20, 2024

I'm talking about generating those public keys that have an RSA PUBLIC KEY header instead of just PUBLIC KEY.

http://www.cryptosys.net/pki/rsakeyformats.html says that the format I want is PKCS#1 RSAPublicKey but the format that's currently implemented seems to be X.509 SubjectPublicKeyInfo.

I once just swapped those comments but that totally broke things :D

from forge.

juliangruber avatar juliangruber commented on July 20, 2024

The format I'm after seems to be

RSAPublicKey ::= SEQUENCE {
          modulus           INTEGER,  -- n
          publicExponent    INTEGER   -- e
      }

whereas the currently implemented format seems to be

SubjectPublicKeyInfo  ::=  SEQUENCE  {
     algorithm            AlgorithmIdentifier,
     subjectPublicKey     BIT STRING  }

...I can't really figure out how those 2 formats differ exactly

from forge.

dlongley avatar dlongley commented on July 20, 2024

A SubjectPublicKeyInfo is a wrapper for an RSAPublicKey. It supports more than just RSA and is the most common format for transporting public keys. Constructing an RSAPublicKey is a prerequisite to storing an RSA key in a SubjectPublicKeyInfo so this was already available in Forge, however, an API for generating just the RSAPublicKey was not exposed because it's not used nearly as often as a SubjectPublicKeyInfo. I quickly added a couple of methods to let you use just the raw RSAPublicKey:

forge.pki.publicKeyToRSAPublicKey
forge.pki.publicKeyToRSAPublicKeyPem

Hopefully this is what you need. If so, please feel free to close the issue.

from forge.

juliangruber avatar juliangruber commented on July 20, 2024

This does exactly what I want, super big thank you!

from forge.

dlongley avatar dlongley commented on July 20, 2024

@juliangruber, great, sure!

from forge.

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.