private void checkConstruction( ProcurationSyntax procuration, String country, DirectoryString typeOfSubstitution, GeneralName thirdPerson, IssuerSerial certRef) throws IOException { checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); procuration = ProcurationSyntax.getInstance(procuration); checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); ASN1InputStream aIn = new ASN1InputStream(procuration.toASN1Primitive().getEncoded()); ASN1Sequence seq = (ASN1Sequence)aIn.readObject(); procuration = ProcurationSyntax.getInstance(seq); checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); }
private void checkConstruction( ProcurationSyntax procuration, String country, DirectoryString typeOfSubstitution, GeneralName thirdPerson, IssuerSerial certRef) throws IOException { checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); procuration = ProcurationSyntax.getInstance(procuration); checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); ASN1InputStream aIn = new ASN1InputStream(procuration.toASN1Object().getEncoded()); ASN1Sequence seq = (ASN1Sequence)aIn.readObject(); procuration = ProcurationSyntax.getInstance(seq); checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef); }
private void checkValues( ProcurationSyntax procuration, String country, DirectoryString typeOfSubstitution, GeneralName thirdPerson, IssuerSerial certRef) { checkOptionalField("country", country, procuration.getCountry()); checkOptionalField("typeOfSubstitution", typeOfSubstitution, procuration.getTypeOfSubstitution()); checkOptionalField("thirdPerson", thirdPerson, procuration.getThirdPerson()); checkOptionalField("certRef", certRef, procuration.getCertRef()); }
private String getProcurationStringValue(byte[] octets) throws IOException { // @formatter:off /* ProcurationSyntax ::= SEQUENCE { country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL, typeOfSubstitution [2] EXPLICIT DirectoryString(SIZE(1..128)) OPTIONAL, signingFor [3] EXPLICIT SigningFor } SigningFor ::= CHOICE { thirdPerson GeneralName, certRef IssuerSerial } */ // @formatter:on StringBuilder sb = new StringBuilder(); ProcurationSyntax procurationSyntax = ProcurationSyntax.getInstance(octets); String country = procurationSyntax.getCountry(); DirectoryString typeOfSubstitution = procurationSyntax.getTypeOfSubstitution(); GeneralName thirdPerson = procurationSyntax.getThirdPerson(); IssuerSerial certRef = procurationSyntax.getCertRef(); if (country != null) { sb.append(MessageFormat.format(res.getString("Procuration.Country"), country)); sb.append(NEWLINE); } if (typeOfSubstitution != null) { sb.append(MessageFormat.format(res.getString("Procuration.TypeOfSubstitution"), typeOfSubstitution.toString())); sb.append(NEWLINE); } if (thirdPerson != null) { sb.append(MessageFormat.format(res.getString("Procuration.ThirdPerson"), GeneralNameUtil.toString(thirdPerson))); sb.append(NEWLINE); } if (certRef != null) { sb.append(res.getString("Procuration.CertRef")); sb.append(NEWLINE); sb.append(INDENT); sb.append(res.getString("Procuration.CertRef.Issuer")); for (GeneralName generalName : certRef.getIssuer().getNames()) { sb.append(INDENT); sb.append(INDENT); sb.append(GeneralNameUtil.toString(generalName)); sb.append(NEWLINE); } sb.append(NEWLINE); sb.append(INDENT); sb.append(MessageFormat.format(res.getString("Procuration.CertRef.SN"), HexUtil.getHexString(certRef.getSerial().getValue()))); sb.append(NEWLINE); } return sb.toString(); }