List of usage examples for org.bouncycastle.asn1.cmp CMPObjectIdentifiers regInfo_utf8Pairs
ASN1ObjectIdentifier regInfo_utf8Pairs
To view the source code for org.bouncycastle.asn1.cmp CMPObjectIdentifiers regInfo_utf8Pairs.
Click Source Link
From source file:org.xipki.ca.client.impl.CmpRequestor.java
License:Open Source License
protected PKIHeader buildPKIHeader(final boolean addImplictConfirm, final ASN1OctetString tid, final CmpUtf8Pairs utf8Pairs, final InfoTypeAndValue... additionalGeneralInfos) { if (additionalGeneralInfos != null) { for (InfoTypeAndValue itv : additionalGeneralInfos) { ASN1ObjectIdentifier type = itv.getInfoType(); if (CMPObjectIdentifiers.it_implicitConfirm.equals(type)) { throw new IllegalArgumentException( "" + "additionGeneralInfos contains unpermitted ITV implicitConfirm"); }//from w w w. j a v a 2 s . c o m if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(type)) { throw new IllegalArgumentException( "" + "additionGeneralInfos contains unpermitted ITV utf8Pairs"); } } } PKIHeaderBuilder hBuilder = new PKIHeaderBuilder(PKIHeader.CMP_2000, sender, recipient != null ? recipient : DUMMY_RECIPIENT); hBuilder.setMessageTime(new ASN1GeneralizedTime(new Date())); ASN1OctetString _tid; if (tid == null) { _tid = new DEROctetString(randomTransactionId()); } else { _tid = tid; } hBuilder.setTransactionID(_tid); List<InfoTypeAndValue> itvs = new ArrayList<>(2); if (addImplictConfirm) { itvs.add(CmpUtil.getImplictConfirmGeneralInfo()); } if (utf8Pairs != null) { itvs.add(CmpUtil.buildInfoTypeAndValue(utf8Pairs)); } if (additionalGeneralInfos != null) { for (InfoTypeAndValue itv : additionalGeneralInfos) { if (itv != null) { itvs.add(itv); } } } if (CollectionUtil.isNotEmpty(itvs)) { hBuilder.setGeneralInfo(itvs.toArray(new InfoTypeAndValue[0])); } return hBuilder.build(); }
From source file:org.xipki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static CmpUtf8Pairs extract(final InfoTypeAndValue[] regInfos) { if (regInfos != null) { for (InfoTypeAndValue regInfo : regInfos) { if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(regInfo.getInfoType())) { String regInfoValue = ((ASN1String) regInfo.getInfoValue()).getString(); return new CmpUtf8Pairs(regInfoValue); }/*from w w w .j a v a2 s . c o m*/ } } return null; }
From source file:org.xipki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static CmpUtf8Pairs extract(final AttributeTypeAndValue[] atvs) { if (atvs == null) { return null; }//from www . j a va 2 s . co m for (AttributeTypeAndValue atv : atvs) { if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(atv.getType())) { String regInfoValue = ((ASN1String) atv.getValue()).getString(); return new CmpUtf8Pairs(regInfoValue); } } return null; }
From source file:org.xipki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static InfoTypeAndValue buildInfoTypeAndValue(final CmpUtf8Pairs utf8Pairs) { return new InfoTypeAndValue(CMPObjectIdentifiers.regInfo_utf8Pairs, new DERUTF8String(utf8Pairs.getEncoded())); }
From source file:org.xipki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static AttributeTypeAndValue buildAttributeTypeAndValue(final CmpUtf8Pairs utf8Pairs) { return new AttributeTypeAndValue(CMPObjectIdentifiers.regInfo_utf8Pairs, new DERUTF8String(utf8Pairs.getEncoded())); }
From source file:org.xipki.pki.ca.client.impl.CmpRequestor.java
License:Open Source License
protected PKIHeader buildPkiHeader(final boolean addImplictConfirm, final ASN1OctetString tid, final CmpUtf8Pairs utf8Pairs, final InfoTypeAndValue... additionalGeneralInfos) { if (additionalGeneralInfos != null) { for (InfoTypeAndValue itv : additionalGeneralInfos) { ASN1ObjectIdentifier type = itv.getInfoType(); if (CMPObjectIdentifiers.it_implicitConfirm.equals(type)) { throw new IllegalArgumentException( "additionGeneralInfos contains not-permitted ITV implicitConfirm"); }/*from w w w .j a va2 s . c om*/ if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(type)) { throw new IllegalArgumentException("additionGeneralInfos contains not-permitted ITV utf8Pairs"); } } } PKIHeaderBuilder hdrBuilder = new PKIHeaderBuilder(PKIHeader.CMP_2000, sender, recipient); hdrBuilder.setMessageTime(new ASN1GeneralizedTime(new Date())); ASN1OctetString tmpTid = (tid == null) ? new DEROctetString(randomTransactionId()) : tid; hdrBuilder.setTransactionID(tmpTid); List<InfoTypeAndValue> itvs = new ArrayList<>(2); if (addImplictConfirm) { itvs.add(CmpUtil.getImplictConfirmGeneralInfo()); } if (utf8Pairs != null) { itvs.add(CmpUtil.buildInfoTypeAndValue(utf8Pairs)); } if (additionalGeneralInfos != null) { for (InfoTypeAndValue itv : additionalGeneralInfos) { if (itv != null) { itvs.add(itv); } } } if (CollectionUtil.isNonEmpty(itvs)) { hdrBuilder.setGeneralInfo(itvs.toArray(new InfoTypeAndValue[0])); } return hdrBuilder.build(); }
From source file:org.xipki.pki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static CmpUtf8Pairs extract(final InfoTypeAndValue[] regInfos) { if (regInfos == null) { return null; }/*from ww w .jav a 2s.c om*/ for (InfoTypeAndValue regInfo : regInfos) { if (CMPObjectIdentifiers.regInfo_utf8Pairs.equals(regInfo.getInfoType())) { String regInfoValue = ((ASN1String) regInfo.getInfoValue()).getString(); return new CmpUtf8Pairs(regInfoValue); } } return null; }
From source file:org.xipki.pki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static InfoTypeAndValue buildInfoTypeAndValue(final CmpUtf8Pairs utf8Pairs) { ParamUtil.requireNonNull("utf8Pairs", utf8Pairs); return new InfoTypeAndValue(CMPObjectIdentifiers.regInfo_utf8Pairs, new DERUTF8String(utf8Pairs.getEncoded())); }
From source file:org.xipki.pki.ca.common.cmp.CmpUtil.java
License:Open Source License
public static AttributeTypeAndValue buildAttributeTypeAndValue(final CmpUtf8Pairs utf8Pairs) { ParamUtil.requireNonNull("utf8Pairs", utf8Pairs); return new AttributeTypeAndValue(CMPObjectIdentifiers.regInfo_utf8Pairs, new DERUTF8String(utf8Pairs.getEncoded())); }