wwwtyro / cryptico

An easy-to-use encryption system utilizing RSA and AES for javascript.
http://wwwtyro.github.com/cryptico
1.18k stars 344 forks source link

RSA key serialization #3

Open rca opened 11 years ago

rca commented 11 years ago

I didn't notice a way to serialize an RSAKey object, so I created the following.

Thoughts?

Calling key.toJSON() creates an object that is serializable with:

JSON.stringify(key.toJSON())

The RSA key can be recreated using:

RSA.parse(JSON.parse(rsaString))
BinaryMuse commented 11 years ago

As implemented in this PR, RSAParse already does a JSON.parse, so the example would be:

RSA.parse(rsaString)

Took me a moment to realize this, so perhaps this note will help someone else.

stephensprinkle-zz commented 11 years ago

Fantastic! Thanks so much. Got stuck on this aspect in a project and this solved it.

hawkps commented 9 years ago

This is awesome, really helped me out! why isn't it in the official file?

kitwalker12 commented 9 years ago

:+1: This is awesome. helped me out with a case where I wanted to encrypt at one location and decrypt elsewhere without sharing the pass phrase

simkessy commented 8 years ago

Can we pull this in? I'd really like to store the key in my application without sharing the passphrase

therightstuff commented 8 years ago

are @wwwtyro and @rca interested in continuing this? i'm happy to jump in or fork and pull and maintain if not. this is really useful and all that's blocking it is an extra comma...

beenotung commented 6 years ago

it seems merged somehow, this PR can be clossed

ayazzali commented 6 years ago

coool! but its realy hard to find.

dansgithubuser commented 5 years ago

This repo is behind the npm distribution? That's exactly the kind of thing I don't want in an npm package offering security....

edit: ended up using web crypto, I needed symmetric encryption too https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto