application/ClientUtil.js
/**
     * 
     * @param {BeanDataBlock} blockData Data block with the set of process information.
     */
@param {BeanDataBlock} blockData Data block with the set of process information.
@param { BeanDataBlock } blockData Data block with the set of process information .
async validateIssuerDateTime(blockData) {
        let issuer = blockData.issuer;
        let dateTimeIssue = blockData.dateTimeIssue;
        var diffDateOK = false;
        diffDateOK = EccUtil.isBeginDateLowerEndDate(dateTimeIssue, new Date());
        if (!diffDateOK) {
            let msgError = 'Actual date is lower than issued date';
            logWrite(`[validateIssuerDateTime] Message: ${msgError}`);
            throw msgError;
        }
        let hashFactory = this.createHash();
        let dateTimeIssueHash = hashFactory.update(dateTimeIssue.toString()).digest(hex);
        let dateTimeSignedByIssuer = blockData.dateTimeSignedByIssuer;
        let verifyHashDateTimeIssue = false;
        verifyHashDateTimeIssue = await EccUtil.verifyMessageSigned(dateTimeIssueHash, dateTimeSignedByIssuer, issuer);
        if (!verifyHashDateTimeIssue) {
            let msgError = 'Date-Time Data Incorrect. Issuer Publick Key Not Validated';
            logWrite(`[validateIssuerDateTime] Message: ${msgError}`);
            throw msgError;
        }
        logWrite('[validateIssuerDateTime] Date-Time Data Ckecked');
        return verifyHashDateTimeIssue;
    }
async validateIssuerDateTime ( blockData ) { let issuer = blockData . issuer ; let dateTimeIssue = blockData . dateTimeIssue ; var diffDateOK = false ; diffDateOK = EccUtil . isBeginDateLowerEndDate ( dateTimeIssue , new Date ( ) ) ; if ( ! diffDateOK ) { let msgError = 'Actual date is lower than issued date' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } let hashFactory = this . createHash ( ) ; let dateTimeIssueHash = hashFactory . update ( dateTimeIssue . toString ( ) ) . digest ( hex ) ; let dateTimeSignedByIssuer = blockData . dateTimeSignedByIssuer ; let verifyHashDateTimeIssue = false ; verifyHashDateTimeIssue = await EccUtil . verifyMessageSigned ( dateTimeIssueHash , dateTimeSignedByIssuer , issuer ) ; if ( ! verifyHashDateTimeIssue ) { let msgError = 'Date-Time Data Incorrect. Issuer Publick Key Not Validated' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } logWrite ( '[validateIssuerDateTime] Date-Time Data Ckecked' ) ; return verifyHashDateTimeIssue ; }
@param {BeanDataBlock} blockData Data block with the set of process information.
@param { BeanDataBlock } blockData Data block with the set of process information .
//stop here; // The date and time must be signed by Issuer to avoid counterfeiting // Recipient will have to validate this signature //stop here; // Date-Time: OK ---------------------------------------