Changeset 2847 for trunk/phpgwapi


Ignore:
Timestamp:
05/25/10 10:40:13 (14 years ago)
Author:
amuller
Message:

Ticket #1086 - Implementando a classe rsa com passagem entre php e js

Location:
trunk/phpgwapi
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.common.inc.php

    r2846 r2847  
    392392                                                $webserver_url .= '/'; 
    393393 
     394                                        require_once('class.rsa.inc.php'); 
     395                                        $rsa = new rsa(); 
    394396                                        $expressolivre = CreateObject( 'phpgwapi.expressolivre' ); 
    395397 
     
    398400                                                . 'var template = "' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ] . '";' 
    399401                                                . 'var ExpressoLivre = function ExpressoLivre( ) { return String( \'' . $expressolivre -> configuration( ) . '\' ); };' 
     402                                                . 'keys = ['.$rsa->get_publKey().','.$rsa->get_mod().'];' 
    400403                                                . '</script>'; 
    401404 
    402405                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'wz_dragdrop', 'wz_dragdrop', NULL, true ); 
    403406                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'expressoAjax', NULL, true ); 
     407 
     408                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'bigInt', NULL, true ); 
     409 
    404410                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'dom', NULL, true ); 
    405411                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressolivre','expressolivre', NULL, true ); 
  • trunk/phpgwapi/js/expressoAjax/expressoAjax.js

    r2752 r2847  
    287287        cConnector.prototype.newRequest = function (id, target, method, handler, data) 
    288288        { 
     289 
    289290                _connector.go( { 
    290291                        "access" : target, 
     
    295296                        "cache": expresso.connector.cacheRequest 
    296297                } ); 
     298 
     299 
    297300                this.cacheRequest=false; 
    298301        }; 
     
    472475        expresso.connector.loadScript(module); 
    473476}; 
     477 
     478(function( ) 
     479{ 
     480        var sec_key = null; 
     481        var mod = null; 
     482        function encode( data ) 
     483        { 
     484                var result = ""; 
     485                var val = ""; 
     486                var packsize = 3; 
     487                for (i=0; i < data.length; i+=packsize){ 
     488                        for (j=i; j < i+packsize; j++) 
     489                                if (data.charCodeAt(j) > 1) 
     490                                        val += ""+data.charCodeAt(j); 
     491                                else 
     492                                        val += "000"; 
     493                        bigVal = int2bigInt(val,50,10); 
     494                        val = ""; 
     495                        bigKey = int2bigInt(sec_key,50,10); 
     496                        bigN = int2bigInt(mod,50,10); 
     497                        bigResult = powMod(bigVal,bigKey,bigN); 
     498                        result += bigInt2str(bigResult,10)+" "; 
     499                } 
     500                return result; 
     501        } 
     502 
     503        function crypt( input, modulus ) 
     504        { 
     505                sec_key = input; 
     506                mod = modulus; 
     507 
     508        } 
     509 
     510        crypt.prototype.encode = encode; 
     511        window.crypt = crypt; 
     512})( ); 
     513 
     514expressoAjax.prototype.crypt = new crypt(keys[0],keys[1]); 
     515delete(keys); 
     516 
    474517var expresso = new expressoAjax(); 
Note: See TracChangeset for help on using the changeset viewer.