import { AES, CryptoHelper, CryptoUtil, StrUtil } from '@pura/harmony-utils';

export class AESpkcs7paddingUtil {
  static decryptNormal(encryptStr: string, key: string): string {
    let dataBlob = CryptoHelper.strToDataBlob(encryptStr, 'base64');
    let keyBytes = CryptoUtil.getConvertSymKeySync('AES256', key, 'utf-8')
    let ivParams= CryptoUtil.getIvParamsSpec(key.substring(0, 16), 'utf-8')
    let plain = AES.decryptCBCSync(dataBlob, keyBytes, ivParams);
    return StrUtil.unit8ArrayToStr(plain.data);
  }
}