bin2int($mod); $e = $math->bin2int($exp); $ret = ""; $begin = 0; $data_len = strlen($data); do { if($data_len-$begin<$max_block_len) $len = $data_len-$begin; else $len = $max_block_len; $tmp = "\x00\x01"; $tmp .= chr($len); for($i=0;$i<$mod_len-4-$len;$i++) { $tmp .= "\xff"; } $tmp .= "\x00"; $tmp .= substr($data,$begin,$len); $m = $math->bin2int(strrev($tmp)); $c = $math->powmod($m,$e,$n); $ret .= strrev($math->int2bin($c)); $begin += $max_block_len; } while($begin<$data_len); return $ret; } /** * Provide MARX compatible RSA decryption * @param key data * @param data to be encrypted * @return decrypted data */ function RSA_Decrypt($key,$enc_data) { if(function_exists('gmp_add')) { $math = new Crypt_RSA_Math_GMP(); } else { $math = new Crypt_RSA_Math_BCMath(); } $bits = ord($key[0])+256*ord($key[1]); $mod_len = floor(($bits + 7)/8); $mod = strrev(substr($key,2,$mod_len)); $exp = strrev(substr($key,130,$mod_len)); $n = $math->bin2int($mod); $d = $math->bin2int($exp); $ret = ""; $begin = 0; $data_len = strlen($enc_data); do { $c = $math->bin2int(strrev(substr($enc_data,$begin,$mod_len))); $dec_data = strrev($math->int2bin($math->powmod($c,$d,$n))); if(ord($dec_data[0])!=1) { return; } for($i=2;$i<$mod_len;$i++) { if(ord($dec_data[$i])!=255) break; } if(ord($dec_data[$i])!=0) { return; } if($mod_len-$i-2<>ord($dec_data[1])) { return; } $ret .= substr($dec_data,$i+1,ord($dec_data[1])); $begin += $mod_len; } while($begin<$data_len); return $ret; } ?> MARX Software Security - Software Protection, License Management, Web Security, Copy Protection, Document Protection, Dongle, USB Token - Solutions getHTMLHeader()); ?>
getMozillaCode()); ?>

MARX® WEB API Online Demo

Welcome to WebSec NetSetup!

NetSetup will check if your web browser is correctly configured for
MARX® Web Security 3.5. It will show you how to set up your browser,
install drivers and updates.



Back to start page