Constructors Summary |
---|
AttributeCertificateHolder(org.bouncycastle.asn1.ASN1Sequence seq)
holder = Holder.getInstance(seq);
|
public AttributeCertificateHolder(org.bouncycastle.jce.X509Principal issuerName, BigInteger serialNumber)
holder = new org.bouncycastle.asn1.x509.Holder(new IssuerSerial(
new GeneralNames(new DERSequence(new GeneralName(issuerName))),
new DERInteger(serialNumber)));
|
public AttributeCertificateHolder(X500Principal issuerName, BigInteger serialNumber)
this(X509Util.convertPrincipal(issuerName), serialNumber);
|
public AttributeCertificateHolder(X509Certificate cert)
X509Principal name;
try
{
name = PrincipalUtil.getIssuerX509Principal(cert);
}
catch (Exception e)
{
throw new CertificateParsingException(e.getMessage());
}
holder = new Holder(new IssuerSerial(generateGeneralNames(name), new DERInteger(cert.getSerialNumber())));
|
public AttributeCertificateHolder(org.bouncycastle.jce.X509Principal principal)
holder = new Holder(generateGeneralNames(principal));
|
public AttributeCertificateHolder(X500Principal principal)
this(X509Util.convertPrincipal(principal));
|
Methods Summary |
---|
public java.lang.Object | clone()
return new AttributeCertificateHolder((ASN1Sequence)holder.toASN1Object());
|
private org.bouncycastle.asn1.x509.GeneralNames | generateGeneralNames(org.bouncycastle.jce.X509Principal principal)
return new GeneralNames(new DERSequence(new GeneralName(principal)));
|
public java.security.Principal[] | getEntityNames()Return any principal objects inside the attribute certificate holder entity names field.
if (holder.getEntityName() != null)
{
return getPrincipals(holder.getEntityName());
}
return null;
|
public java.security.Principal[] | getIssuer()Return the principals associated with the issuer attached to this holder
if (holder.getBaseCertificateID() != null)
{
return getPrincipals(holder.getBaseCertificateID().getIssuer());
}
return null;
|
private java.lang.Object[] | getNames(org.bouncycastle.asn1.x509.GeneralName[] names)
List l = new ArrayList(names.length);
for (int i = 0; i != names.length; i++)
{
if (names[i].getTagNo() == GeneralName.directoryName)
{
try
{
l.add(new X500Principal(((ASN1Encodable)names[i].getName()).getEncoded()));
}
catch (IOException e)
{
throw new RuntimeException("badly formed Name object");
}
}
}
return l.toArray(new Object[l.size()]);
|
private java.security.Principal[] | getPrincipals(org.bouncycastle.asn1.x509.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 java.math.BigInteger | getSerialNumber()Return the serial number associated with the issuer attached to this holder.
if (holder.getBaseCertificateID() != null)
{
return holder.getBaseCertificateID().getSerial().getValue();
}
return null;
|
public boolean | match(java.security.cert.Certificate cert)
if (!(cert instanceof X509Certificate))
{
return false;
}
X509Certificate x509Cert = (X509Certificate)cert;
try
{
if (holder.getBaseCertificateID() != null)
{
return holder.getBaseCertificateID().getSerial().getValue().equals(x509Cert.getSerialNumber())
&& matchesDN(PrincipalUtil.getIssuerX509Principal(x509Cert), holder.getBaseCertificateID().getIssuer());
}
if (holder.getEntityName() != null)
{
if (matchesDN(PrincipalUtil.getSubjectX509Principal(x509Cert), holder.getEntityName()))
{
return true;
}
}
}
catch (CertificateEncodingException e)
{
return false;
}
/**
* objectDigestInfo not supported
*/
return false;
|
private boolean | matchesDN(org.bouncycastle.jce.X509Principal subject, org.bouncycastle.asn1.x509.GeneralNames targets)
GeneralName[] names = targets.getNames();
for (int i = 0; i != names.length; i++)
{
GeneralName gn = names[i];
if (gn.getTagNo() == GeneralName.directoryName)
{
try
{
if (new X509Principal(((ASN1Encodable)gn.getName()).getEncoded()).equals(subject))
{
return true;
}
}
catch (IOException e)
{
}
}
}
return false;
|