public GeneralNames build() { GeneralName[] tmp = new GeneralName[names.size()]; for (int i = 0; i != tmp.length; i++) { tmp[i] = (GeneralName)names.elementAt(i); } return new GeneralNames(tmp); } }
static List<PKIXCertStore> getAdditionalStoresFromAltNames( byte[] issuerAlternativeName, Map<GeneralName, PKIXCertStore> altNameCertStoreMap) throws CertificateParsingException { // if in the IssuerAltName extension an URI // is given, add an additional X.509 store if (issuerAlternativeName != null) { GeneralNames issuerAltName = GeneralNames.getInstance(ASN1OctetString.getInstance(issuerAlternativeName).getOctets()); GeneralName[] names = issuerAltName.getNames(); List<PKIXCertStore> stores = new ArrayList<PKIXCertStore>(); for (int i = 0; i != names.length; i++) { GeneralName altName = names[i]; PKIXCertStore altStore = altNameCertStoreMap.get(altName); if (altStore != null) { stores.add(altStore); } } return stores; } else { return Collections.EMPTY_LIST; } }
/** * create an AuthorityKeyIdentifier with the GeneralNames tag and * the serial number provided. */ public AuthorityKeyIdentifier( GeneralNames name, BigInteger serialNumber) { this.keyidentifier = null; this.certissuer = GeneralNames.getInstance(name.toASN1Primitive()); this.certserno = new ASN1Integer(serialNumber); }
public GeneralNamesBuilder addNames(GeneralNames names) { GeneralName[] n = names.getNames(); for (int i = 0; i != n.length; i++) { this.names.addElement(n[i]); } return this; }
public static GeneralNames getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
public String toString() { String sep = System.getProperty("line.separator"); StringBuffer buf = new StringBuffer(); buf.append("DistributionPoint: ["); buf.append(sep); if (distributionPoint != null) { appendObject(buf, sep, "distributionPoint", distributionPoint.toString()); } if (reasons != null) { appendObject(buf, sep, "reasons", reasons.toString()); } if (cRLIssuer != null) { appendObject(buf, sep, "cRLIssuer", cRLIssuer.toString()); } buf.append("]"); buf.append(sep); return buf.toString(); }
private Principal[] getPrincipals(GeneralNames names) { Object[] p = this.getNames(names.getNames()); List l = new ArrayList(); for (int i = 0; i != p.length; i++) { if (p[i] instanceof Principal) { l.add(p[i]); } } return (Principal[])l.toArray(new Principal[l.size()]); }
public static GeneralNames getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
public String toString() { String sep = Strings.lineSeparator(); StringBuffer buf = new StringBuffer(); buf.append("DistributionPoint: ["); buf.append(sep); if (distributionPoint != null) { appendObject(buf, sep, "distributionPoint", distributionPoint.toString()); } if (reasons != null) { appendObject(buf, sep, "reasons", reasons.toString()); } if (cRLIssuer != null) { appendObject(buf, sep, "cRLIssuer", cRLIssuer.toString()); } buf.append("]"); buf.append(sep); return buf.toString(); }
private Set loadCRLEntries() { Set entrySet = new HashSet(); Enumeration certs = c.getRevokedCertificateEnumeration(); X500Name previousCertificateIssuer = null; // the issuer while (certs.hasMoreElements()) { TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry)certs.nextElement(); X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer); entrySet.add(crlEntry); if (isIndirect && entry.hasExtensions()) { Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer); if (currentCaName != null) { previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName()); } } } return entrySet; }
public void setRequester(GeneralNames requester) { // RFC 3029, 9.1: The DVCS MAY modify the fields // 'dvcs', 'requester', 'dataLocations', and 'nonce' of the ReqInfo structure this.requester = requester; }
private Principal[] getPrincipals(GeneralNames names) { Object[] p = this.getNames(names.getNames()); List l = new ArrayList(); for (int i = 0; i != p.length; i++) { if (p[i] instanceof Principal) { l.add(p[i]); } } return (Principal[])l.toArray(new Principal[l.size()]); }
public static GeneralNames fromExtensions(Extensions extensions, ASN1ObjectIdentifier extOID) { return GeneralNames.getInstance(extensions.getExtensionParsedValue(extOID)); }
/** * create an AuthorityKeyIdentifier with a precomupted key identifier * and the GeneralNames tag and the serial number provided as well. */ public AuthorityKeyIdentifier( byte[] keyIdentifier, GeneralNames name, BigInteger serialNumber) { this.keyidentifier = new DEROctetString(keyIdentifier); this.certissuer = GeneralNames.getInstance(name.toASN1Primitive()); this.certserno = new ASN1Integer(serialNumber); }
private Set loadCRLEntries() { Set entrySet = new HashSet(); Enumeration certs = c.getRevokedCertificateEnumeration(); X500Name previousCertificateIssuer = null; // the issuer while (certs.hasMoreElements()) { TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry)certs.nextElement(); X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer); entrySet.add(crlEntry); if (isIndirect && entry.hasExtensions()) { Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer); if (currentCaName != null) { previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName()); } } } return entrySet; }
public void setDVCS(GeneralNames dvcs) { // RFC 3029, 9.1: The DVCS MAY modify the fields // 'dvcs', 'requester', 'dataLocations', and 'nonce' of the ReqInfo structure this.dvcs = dvcs; }
public String toString() { StringBuffer buff = new StringBuffer("Name: " + this.getRoleNameAsString() + " - Auth: "); if(this.roleAuthority == null || roleAuthority.getNames().length == 0) { buff.append("N/A"); } else { String[] names = this.getRoleAuthorityAsString(); buff.append('[').append(names[0]); for(int i = 1; i < names.length; i++) { buff.append(", ").append(names[i]); } buff.append(']'); } return buff.toString(); } }
public DistributionPointName( ASN1TaggedObject obj) { this.type = obj.getTagNo(); if (type == 0) { this.name = GeneralNames.getInstance(obj, false); } else { this.name = ASN1Set.getInstance(obj, false); } }
/** * create an AuthorityKeyIdentifier with the GeneralNames tag and * the serial number provided as well. */ public AuthorityKeyIdentifier( SubjectPublicKeyInfo spki, GeneralNames name, BigInteger serialNumber) { Digest digest = new SHA1Digest(); byte[] resBuf = new byte[digest.getDigestSize()]; byte[] bytes = spki.getPublicKeyData().getBytes(); digest.update(bytes, 0, bytes.length); digest.doFinal(resBuf, 0); this.keyidentifier = new DEROctetString(resBuf); this.certissuer = GeneralNames.getInstance(name.toASN1Primitive()); this.certserno = new ASN1Integer(serialNumber); }
private Set loadCRLEntries() { Set entrySet = new HashSet(); Enumeration certs = c.getRevokedCertificateEnumeration(); X500Name previousCertificateIssuer = null; // the issuer while (certs.hasMoreElements()) { TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry)certs.nextElement(); X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer); entrySet.add(crlEntry); if (isIndirect && entry.hasExtensions()) { Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer); if (currentCaName != null) { previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName()); } } } return entrySet; }