Skip to content
This repository was archived by the owner on Jul 22, 2021. It is now read-only.

Latest commit

 

History

History
51 lines (35 loc) · 1.27 KB

File metadata and controls

51 lines (35 loc) · 1.27 KB

RSAsync for Rails Assets Pipeline

RSAsync Javascript asynchronous rsa key generation - extends jsbn.

Usage

  • Include rsasync-rails in the Gemfile:

    #!ruby
    gem 'rsasync-rails', '13.2.11.1', git: 'https://bitbucket.org/gimiscale/rsasync-rails.git'
    
  • Add to app/assets/javascripts/applications.js:

    #!javascript
    // RSA keygen, encoding, decoding, etc...
    //= require rsasync-rails
    // RSA (public/private) key formatting for SSH
    //= require ssh-format-rails
    

    Optional:

    #!javascript
    // SHA-1 hash function
    //= require jsbn-sha1-rails
    
    // Elliptic Curve Math
    //= require jsbn-ecc-rails
    
  • For best results, put code like following in your main HTML document.

    #!html
    <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
    
  • Example use in JavaScript:

    #!javascript
    key = new RSAKey();
    key.generateAsync(512, "03", function(){
        var pubKey = generatePublicKey(key);
        var priKey = generatePrivateKeyBlock(key);
        alert(pubKey);
        alert(priKey);
    });
    

License

See LICENSE.md.