third_party/gecko-15/win32/bin/components/nsUrlClassifierLib.js
/**
 * A key manager for UrlCrypto. There should be exactly one of these
 * per appplication, and all UrlCrypto's should share it. This is
 * currently implemented by having the manager attach itself to the
 * UrlCrypto's prototype at startup. We could've opted for a global
 * instead, but I like this better, even though it is spooky action
 * at a distance.
 * XXX: Should be an XPCOM service
 *
 * @param opt_keyFilename String containing the name of the 
 *                        file we should serialize keys to/from. Used
 *                        mostly for testing.
 *
 * @param opt_testing Boolean indicating whether we are testing. If we 
 *                    are, then we skip trying to read the old key from
 *                    file and automatically trying to rekey; presumably
 *                    the tester will drive these manually.
 *
 * @constructor
 */
A key manager for UrlCrypto. There should be exactly one of these
per appplication, and all UrlCrypto's should share it. This is
currently implemented by having the manager attach itself to the
UrlCrypto's prototype at startup. We could've opted for a global
instead, but I like this better, even though it is spooky action
at a distance.
XXX: Should be an XPCOM service

@param opt_keyFilename String containing the name of the
file we should serialize keys to/from. Used
mostly for testing.

@param opt_testing Boolean indicating whether we are testing. If we
are, then we skip trying to read the old key from
file and automatically trying to rekey; presumably
the tester will drive these manually.

@constructor
A key manager for UrlCrypto . There should be exactly one of these per appplication and all UrlCrypto ' s should share it . This is currently implemented by having the manager attach itself to the UrlCrypto ' s prototype at startup . We could ' ve opted for a global instead but I like this better even though it is spooky action at a distance . XXX : Should be an XPCOM service @param opt_keyFilename String containing the name of the file we should serialize keys to / from . Used mostly for testing . @param opt_testing Boolean indicating whether we are testing . If we are then we skip trying to read the old key from file and automatically trying to rekey ; presumably the tester will drive these manually . @constructor
function PROT_UrlCryptoKeyManager(opt_keyFilename, opt_testing) {
  this.debugZone = "urlcryptokeymanager";
  this.testing_ = !!opt_testing;
  this.clientKey_ = null;          
  this.clientKeyArray_ = null;     
  this.wrappedKey_ = null;         
  this.rekeyTries_ = 0;
  this.updating_ = false;
  this.keyUrl_ = null;
  this.keyFilename_ = opt_keyFilename ? 
                      opt_keyFilename : kKeyFilename;
  this.onNewKey_ = null;
  this.MAX_REKEY_TRIES = PROT_UrlCryptoKeyManager.MAX_REKEY_TRIES;
  this.CLIENT_KEY_NAME = PROT_UrlCryptoKeyManager.CLIENT_KEY_NAME;
  this.WRAPPED_KEY_NAME = PROT_UrlCryptoKeyManager.WRAPPED_KEY_NAME;
  if (!this.testing_) {
    this.maybeLoadOldKey();
  }
}
function PROT_UrlCryptoKeyManager ( opt_keyFilename , opt_testing ) { this . debugZone = "urlcryptokeymanager" ; this . testing_ = ! ! opt_testing ; this . clientKey_ = null ; this . clientKeyArray_ = null ; this . wrappedKey_ = null ; this . rekeyTries_ = 0 ; this . updating_ = false ; this . keyUrl_ = null ; this . keyFilename_ = opt_keyFilename ? opt_keyFilename : kKeyFilename ; this . onNewKey_ = null ; this . MAX_REKEY_TRIES = PROT_UrlCryptoKeyManager . MAX_REKEY_TRIES ; this . CLIENT_KEY_NAME = PROT_UrlCryptoKeyManager . CLIENT_KEY_NAME ; this . WRAPPED_KEY_NAME = PROT_UrlCryptoKeyManager . WRAPPED_KEY_NAME ; if ( ! this . testing_ ) { this . maybeLoadOldKey ( ) ; } }
A key manager for UrlCrypto.
A key manager for UrlCrypto .
// Base64-encoded, as fetched from server // Base64-decoded into an array of numbers // Opaque websafe base64-encoded server key // Don't do anything until keyUrl_ is set. // Convenience properties