390 |
390 |
391 // ENCRYPTION CODE |
391 // ENCRYPTION CODE |
392 ?> |
392 ?> |
393 <script type="text/javascript"> |
393 <script type="text/javascript"> |
394 <?php if ( getConfig('pw_strength_enable') == '1' ): ?> |
394 <?php if ( getConfig('pw_strength_enable') == '1' ): ?> |
395 password_score_field(document.forms.empwform.newpass); |
395 addOnloadHook(function() |
|
396 { |
|
397 password_score_field(document.forms.empwform.newpass); |
|
398 }); |
396 <?php endif; ?> |
399 <?php endif; ?> |
397 disableJSONExts(); |
400 |
398 str = ''; |
|
399 for(i=0;i<keySizeInBits/4;i++) str+='0'; |
|
400 var key = hexToByteArray(str); |
|
401 var pt = hexToByteArray(str); |
|
402 var ct = rijndaelEncrypt(pt, key, "ECB"); |
|
403 var ct = byteArrayToHex(ct); |
|
404 switch(keySizeInBits) |
|
405 { |
|
406 case 128: |
|
407 v = '66e94bd4ef8a2c3b884cfa59ca342b2e'; |
|
408 break; |
|
409 case 192: |
|
410 v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7'; |
|
411 break; |
|
412 case 256: |
|
413 v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087'; |
|
414 break; |
|
415 } |
|
416 var aes_testpassed = ( ct == v && md5_vm_test() ); |
|
417 function runEncryption() |
401 function runEncryption() |
418 { |
402 { |
|
403 load_component('crypto'); |
|
404 var aes_testpassed = aes_self_test(); |
|
405 |
419 var frm = document.forms.empwform; |
406 var frm = document.forms.empwform; |
420 if ( frm.newpass.value.length < 1 ) |
407 if ( frm.newpass.value.length < 1 ) |
421 return true; |
408 return true; |
422 |
409 |
423 pass1 = frm.newpass.value; |
410 pass1 = frm.newpass.value; |