/** * Add a generalInfo data record to the header of the new message. * * @param genInfo the generalInfo data to be added. * @return the current builder instance. */ public ProtectedPKIMessageBuilder addGeneralInfo(InfoTypeAndValue genInfo) { generalInfos.add(genInfo); return this; }
private void finaliseHeader(AlgorithmIdentifier algorithmIdentifier) { hdrBuilder.setProtectionAlg(algorithmIdentifier); if (!generalInfos.isEmpty()) { InfoTypeAndValue[] genInfos = new InfoTypeAndValue[generalInfos.size()]; hdrBuilder.setGeneralInfo((InfoTypeAndValue[])generalInfos.toArray(genInfos)); } }
public static boolean isImplictConfirm(PKIHeader header) { ParamUtil.requireNonNull("header", header); InfoTypeAndValue[] regInfos = header.getGeneralInfo(); if (regInfos == null) { return false; } for (InfoTypeAndValue regInfo : regInfos) { if (CMPObjectIdentifiers.it_implicitConfirm.equals(regInfo.getInfoType())) { return true; } } return false; }
public static CmpUtf8Pairs extract(InfoTypeAndValue[] regInfos) { if (regInfos == null) { return null; } for (InfoTypeAndValue regInfo : regInfos) { if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(regInfo.getInfoType())) { String regInfoValue = ((ASN1String) regInfo.getInfoValue()).getString(); return new CmpUtf8Pairs(regInfoValue); } } return null; }
public static InfoTypeAndValue getImplictConfirmGeneralInfo() { return new InfoTypeAndValue(CMPObjectIdentifiers.it_implicitConfirm, DERNull.INSTANCE); }
public static InfoTypeAndValue buildInfoTypeAndValue(CmpUtf8Pairs utf8Pairs) { ParamUtil.requireNonNull("utf8Pairs", utf8Pairs); return new InfoTypeAndValue(CMPObjectIdentifiers.regInfo_utf8Pairs, new DERUTF8String(utf8Pairs.encoded())); }