/** * Return an AttributeCertificate interpretation of otherCert. * @deprecated use getOtherCert and getOtherTag to make sure message is really what it should be. * * @return an AttributeCertificate */ public AttributeCertificate getX509v2AttrCert() { return AttributeCertificate.getInstance(otherCert); }
/** * Return an AttributeCertificate interpretation of otherCert. * @deprecated use getOtherCert and getOtherTag to make sure message is really what it should be. * * @return an AttributeCertificate */ public AttributeCertificate getX509v2AttrCert() { return AttributeCertificate.getInstance(otherCert); }
/** * Sets Attribute certificates, which will be added as the VOMS extensions to the generated proxy. * @param ac to be set * @throws IOException IO exception */ public void setAttributeCertificates(AttributeCertificate[] ac) throws IOException { attributeCertificates = new AttributeCertificate[ac.length]; for (int i=0; i<ac.length; i++) attributeCertificates[i] = AttributeCertificate.getInstance(ac[i].getEncoded(ASN1Encoding.DER)); }
/** * * @return Attribute certificates or null if was not set * @throws IOException IO exception */ public AttributeCertificate[] getAttributeCertificates() throws IOException { if (attributeCertificates == null) return null; AttributeCertificate[] ret = new AttributeCertificate[attributeCertificates.length]; for (int i=0; i<attributeCertificates.length; i++) ret[i] = AttributeCertificate.getInstance( attributeCertificates[i].getEncoded(ASN1Encoding.DER)); return ret; } }
private static AttributeCertificate getObject(InputStream in) throws IOException { try { return AttributeCertificate.getInstance(new ASN1InputStream(in).readObject()); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException("exception decoding certificate structure: " + e.toString()); } }
private static List<AttributeCertificate> extractAttributeCertificates(X509Certificate certificate) throws IOException { List<AttributeCertificate> certificates = new ArrayList<>(); byte[] payload = certificate.getExtensionValue(ATTRIBUTE_CERTIFICATE_OID); if(payload == null) { return Collections.emptyList(); } payload = decodeEncapsulation(payload); InputStream in = new ByteArrayInputStream(payload); ASN1Sequence acSequence = (ASN1Sequence) new ASN1InputStream(in).readObject(); for(Enumeration<ASN1Sequence> e1=acSequence.getObjects(); e1.hasMoreElements(); ) { ASN1Sequence acSequence2 = e1.nextElement(); for(Enumeration<ASN1Sequence> e2=acSequence2.getObjects(); e2.hasMoreElements(); ) { ASN1Sequence acSequence3 = e2.nextElement(); certificates.add(AttributeCertificate.getInstance(acSequence3)); } } return certificates; }
/** * Used to get the AC extension object. * * @return The AC object */ public AttributeCertificate[] getAttributeCertificates() { DLSequence seqac = (DLSequence) ac.getObjectAt(0); AttributeCertificate[] ret = new AttributeCertificate[seqac.size()]; for (int i=0; i<ret.length; i++) ret[i] = AttributeCertificate.getInstance(seqac.getObjectAt(i)); return ret; }
AttributeCertificate.getInstance(theACs.nextElement()); acs.add(parsedAC);
/** * Extracts an AC from a VOMS response * * @param request * the request * @param response * the received response * @return a possibly <code>null</code> {@link AttributeCertificate} object */ protected AttributeCertificate getACFromResponse(VOMSACRequest request, VOMSResponse response) { byte[] acBytes = response.getAC(); if (acBytes == null) return null; ASN1InputStream asn1InputStream = new ASN1InputStream(acBytes); AttributeCertificate attributeCertificate = null; try { attributeCertificate = AttributeCertificate.getInstance(asn1InputStream .readObject()); asn1InputStream.close(); return attributeCertificate; } catch (Throwable e) { requestListener.notifyVOMSRequestFailure(request, null, new VOMSError( "Error unmarshalling VOMS AC. Cause: " + e.getMessage(), e)); return null; } }
private SignerAttribute( ASN1Sequence seq) { int index = 0; values = new Object[seq.size()]; for (Enumeration e = seq.getObjects(); e.hasMoreElements();) { ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(e.nextElement()); if (taggedObject.getTagNo() == 0) { ASN1Sequence attrs = ASN1Sequence.getInstance(taggedObject, true); Attribute[] attributes = new Attribute[attrs.size()]; for (int i = 0; i != attributes.length; i++) { attributes[i] = Attribute.getInstance(attrs.getObjectAt(i)); } values[index] = attributes; } else if (taggedObject.getTagNo() == 1) { values[index] = AttributeCertificate.getInstance(ASN1Sequence.getInstance(taggedObject, true)); } else { throw new IllegalArgumentException("illegal tag: " + taggedObject.getTagNo()); } index++; } }
private SignerAttribute( ASN1Sequence seq) { int index = 0; values = new Object[seq.size()]; for (Enumeration e = seq.getObjects(); e.hasMoreElements();) { ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(e.nextElement()); if (taggedObject.getTagNo() == 0) { ASN1Sequence attrs = ASN1Sequence.getInstance(taggedObject, true); Attribute[] attributes = new Attribute[attrs.size()]; for (int i = 0; i != attributes.length; i++) { attributes[i] = Attribute.getInstance(attrs.getObjectAt(i)); } values[index] = attributes; } else if (taggedObject.getTagNo() == 1) { values[index] = AttributeCertificate.getInstance(ASN1Sequence.getInstance(taggedObject, true)); } else { throw new IllegalArgumentException("illegal tag: " + taggedObject.getTagNo()); } index++; } }