I need a client-side crypto library. I've seen https://github.com/digitalbazaar/forge linked many times on stackexchange. Forge seems to be the most complete and well-documented crypto library for JS. However, I have no way to confirm if their implementations of the crypto algorithms are proper and secure. I have not been able to find any third party websites that have audited their source code.

Can anyone confirm this library has been made properly? Has anyone studied their source code?

  • 2
    Possibly off-topic question - why use javascript cryptography instead of SSL? Or are you using both? If so, why would you need both? More on-topic, how could any cryptography in JS be secure? It can't use a cryptographically secure RNG, right?
    – Gray
    Feb 18, 2014 at 20:31
  • 2
    @FrancisSnipe, keep in mind that you need a secure way (e. g. https) to transmit the html and javascript code to the client. Otherwise an attacker can add some code to send a copy of the unencrypted data elsewhere. Feb 19, 2014 at 13:00
  • Please let us know what crypto algorithms or operations you are considering doing client-side. Most of these have published test vectors so you can tell if it's returning the correct results. Now, whether it has other flaws, particularly security flaws, is an entirely different kettle of fish not addressable by test vectors. Feb 20, 2014 at 3:08
  • I am not trying to re-write ssl. The server-client connection is made by https. I just need to perform some crypto functions on the client-side. Feb 21, 2014 at 15:51
  • 1
    @FrancisSnipe - what functions? JavaScript security adds nothing. The security is still only as strong as HTTPS and the server involved. In other words, it's almost always just pointless.
    – MichaelGG
    Mar 2, 2014 at 0:02

1 Answer 1


Javascript as the "main security" in any web-app or site is not a good idea, but its a nice add-on, but it wont add asmuch that it becomes waterproof, so beware (best used with HTTPS ;) )

a Crypto library is never 100% waterproof, i.e., take an encryption, or hashing method called HashA (fictional), in 3, maybe 4 years, an update will be released, lets call that HashB, the reason is that people will study, and try to either crack, or find a weakness in algorithems and codes, so in 4 years, HashA won't be as safe, so poeple tend to bend towards HashB.

To awnser your question, i asked around a little bit for you, we dont use alot of security in JS, but we still prefer to, since its that "little bit extra" we like to do.

the "Forge" JS Crypto Library was first made around late 2009, and went live somewhere in 2010 if i'm right, and has alot of inbuild functions like hashing, storage of passwords, encryption, TLS implention and more.

Since its so a bit "aged", people would sometimes say "better not", but i use it too, and didnt encounter any problems yet, i'd say this is safe, atleast for now, but dont forget to update it when they are released!

here is a link to the main webpage of Froge: http://digitalbazaar.com/forge/

Not the answer you're looking for? Browse other questions tagged or ask your own question.