Git Product home page Git Product logo

Comments (7)

mcarrickscott avatar mcarrickscott commented on July 21, 2024

Yes, that should be possible. In rsa.js there would be a need to provide a new function

set_rsa_public_key = function(ctx,n,e)

similar to the existing

rsa_public_key = function(ctx)

Where the public key n is provided as a byte array extracted from an X.509 cert, and e=65537. Then use the ff.js function

FF.fromBytes = function(x, b)

to copy n into the public key structure.

(Note: we would regard X.509 cert processing as outside of the remit of this library)

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

Ok. Thank you!

Pascal

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

I am not sure, if that is wished, but maybe it could be useful to have getter and setter for the objects rsa_public_key and rsa_private_key. In the following is a suggestion how it could be done:

ctx.rsa_public_key.set(n,e);
ctx.rsa_public_key.set_e(e);
ctx.rsa_public_key.set_n(n);

ctx.rsa_public_key.get_instance(n,e);

Whereby the get_instance method creates a new rsa_public_key object and set the properties n and e.
It is also possible to do respectively also getter and setter for the rsa_private_key and a get_instance method for setting the attributes manually.
What do you think about the idea?

Maybe that would be better as creating a "new" rsa_public_key object and it is possible to use the existing structure.
If you want I can create a Pull Request, depends on if you think that could be useful for the library.

from core.

mcarrickscott avatar mcarrickscott commented on July 21, 2024

Yes, OK, that sounds like a good plan. Make sure and test it on a real X.509 public key!

Mike

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

It seems that it is possible to store a public key in that structure.
I used [1] as asn1 parser and stored the bytes directly into the rsa_public_key structure with the get_instance method.

Pull Request is on the way - without the asn1 parser, only the rsa key data strucutres.

Anyway I have a question regarding the data in the array which I get back from the FF data structure.
Which representation have the content of the following array?

[ 190,  66, 142, 139,  46, 151, 187, 158, 173, 174, 147, 123, ... ]

is the the 190 (from index 0) in hex or in uint or something else? I am a bit confused about the representation and wanted to know which representation are used here.

Thank you in advance!

[1] https://git.coolaj86.com/coolaj86/asn1-parser.js

from core.

mcarrickscott avatar mcarrickscott commented on July 21, 2024

Those are just unsigned byte values, in decimal

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

Thank you.

from core.

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.