Menu

Error: TypeError: pidCrypt.AES.CTR is not a constructor

Help
2013-05-28
2013-05-31
  • Mario Pilesi

    Mario Pilesi - 2013-05-28

    I made a script that loads a file and decrypts it.
    Generally works without problems.
    Only a few times once I start browers, I get this error:
    Error: TypeError: pidCrypt.AES.CTR is not a constructor
    Do it is a timeout problem?
    How to solve?

     
  • Jonah (pidder)

    Jonah (pidder) - 2013-05-29

    The error means that your script is trying to call a constructor that isn't known at that point.

    Resaons for this could be

    • there was a runtime error somewhere in your javascript
    • there is problem with the sequence in your code, i.e. the constructor is called before the libraries are available
    • the conditions in the definition of the constructor if(typeof(pidCrypt) != 'undefined' && typeof(pidCrypt.AES) != 'undefined') aren't fulfilled

    Please make sure that pcrypt.js, pidcrypt_util.js and aes_core.js are loaded before aes_ctr.js and all of them are loaded before calling the constructor.

     
  • Mario Pilesi

    Mario Pilesi - 2013-05-30

    I tried also:
    while(typeof pidCrypt === 'undefined' && typeof pidCrypt.AES === 'undefined' && typeof pidCrypt.AES.CTR === 'undefined'){}
    var aes = new pidCrypt.AES.CTR();
    but not solve.
    I will try
    while(typeof pidCrypt === 'undefined' || typeof pidCrypt.AES === 'undefined' || typeof pidCrypt.AES.CTR === 'undefined'){}

     

    Last edit: Mario Pilesi 2013-05-30
  • Mario Pilesi

    Mario Pilesi - 2013-05-31

    I tried but when it happens it hang.

     

    Last edit: Mario Pilesi 2013-05-31

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.