checkSecurity(){
        if(this.securityLevel === 'HIGH'){
            if(this.q === undefined)
                if(this.p === undefined)
                    throw new Error('Engine is not initialized')
                else
                    this.q = this.p.minus(1).divide(2);
            else if(this.q.multiply(2).add(1).compare(this.p))
                throw new Error('Inconsistent Group Order and Group Modulus');
            
            if(! this.p.isProbablePrime())
                return false;
            else if(! this.q.isProbablePrime())
                return false;
        }else if(this.securityLevel === 'MEDIUM'){
            if(this.p === undefined)
                throw new Error('Engine is not initialized!');
            
            if(! this.p.isProbablePrime())
                return false;
        }else
            log('Warning: Low level security detected');
        
        this.isSecure = true;
        return true;
    }
/**
     * Check the security of engine regarding the configured security level 
     * @returns {boolean} true if the engine is at given security level, otherwise false
     * @throws Will throw an error if the engine is not initialized correctly.
     */
Check the security of engine regarding the configured security level
@returns {boolean} true if the engine is at given security level, otherwise false
@throws Will throw an error if the engine is not initialized correctly.
Check the security of engine regarding the configured security level @returns { boolean } true if the engine is at given security level otherwise false @throws Will throw an error if the engine is not initialized correctly .
checkSecurity(){
        if(this.securityLevel === 'HIGH'){
            if(this.q === undefined)
                if(this.p === undefined)
                    throw new Error('Engine is not initialized')
                else
                    this.q = this.p.minus(1).divide(2);
            else if(this.q.multiply(2).add(1).compare(this.p))
                throw new Error('Inconsistent Group Order and Group Modulus');
            if(! this.p.isProbablePrime())
                return false;
            else if(! this.q.isProbablePrime())
                return false;
        }else if(this.securityLevel === 'MEDIUM'){
            if(this.p === undefined)
                throw new Error('Engine is not initialized!');
            if(! this.p.isProbablePrime())
                return false;
        }else
            log('Warning: Low level security detected');
        this.isSecure = true;
        return true;
    }
checkSecurity ( ) { if ( this . securityLevel === 'HIGH' ) { if ( this . q === undefined ) if ( this . p === undefined ) throw new Error ( 'Engine is not initialized' ) else this . q = this . p . minus ( 1 ) . divide ( 2 ) ; else if ( this . q . multiply ( 2 ) . add ( 1 ) . compare ( this . p ) ) throw new Error ( 'Inconsistent Group Order and Group Modulus' ) ; if ( ! this . p . isProbablePrime ( ) ) return false ; else if ( ! this . q . isProbablePrime ( ) ) return false ; } else if ( this . securityLevel === 'MEDIUM' ) { if ( this . p === undefined ) throw new Error ( 'Engine is not initialized!' ) ; if ( ! this . p . isProbablePrime ( ) ) return false ; } else log ( 'Warning: Low level security detected' ) ; this . isSecure = true ; return true ; }
Check the security of engine regarding the configured security level
 @returns {boolean} true if the engine is at given security level, otherwise false
 @throws Will throw an error if the engine is not initialized correctly.
Check the security of engine regarding the configured security level @returns { boolean } true if the engine is at given security level otherwise false @throws Will throw an error if the engine is not initialized correctly .