dojox/encoding/crypto/RSAKey.js

  • Provides:

    • dojox.encoding.crypto.RSAKey
  • dojox.encoding.crypto.RSAKey

    • type
      Function
    • parameters:
      • rngf: (typeof )
    • source: [view]
         this.rngf = rngf || defaultRngf;
         this.e = 0;
         this.n = this.d = this.p = this.q = this.dmp1 = this.dmq1 = this.coeff = null;
    • summary
      "empty" RSA key constructor
      rndf: Function?:
      function that returns an instance of a random number generator
      (see dojox.math.random for details)
  • dojox.encoding.crypto.RSAKey.setPublic

    • type
      Function
    • parameters:
      • N: (typeof )
      • E: (typeof )
    • source: [view]
         if(N && E && N.length && E.length) {
          this.n = new BigInteger(N, 16);
          this.e = parseInt(E, 16);
         }else{
          throw new Error("Invalid RSA public key");
         }
    • summary
      Set the public key fields N and e from hex strings
  • dojox.encoding.crypto.RSAKey.encrypt

    • type
      Function
    • parameters:
      • text: (typeof )
    • source: [view]
         var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3, this.rngf);
         if(!m){
          return null;
         }
         var c = m.modPowInt(this.e, this.n);
         if(!c){
          return null;
         }
         var h = c.toString(16);
         return h.length % 2 ? "0" + h : h;
    • summary
  • dojox.encoding.crypto.RSAKey.n

    • summary
  • dojox.encoding.crypto.RSAKey.e

    • summary
  • dojox.encoding.crypto.RSAKey.rngf

    • summary
  • defaultRngf

    • type
      Function
    • source: [view]
        defaultRngf = function(){ return new Simple();
    • summary
  • dojox.encoding.crypto

    • type
      Object
    • summary
  • dojox.encoding

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary