本文整理汇总了Java中org.bouncycastle.asn1.x509.X509Name.getOIDs方法的典型用法代码示例。如果您正苦于以下问题:Java X509Name.getOIDs方法的具体用法?Java X509Name.getOIDs怎么用?Java X509Name.getOIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.x509.X509Name
的用法示例。
在下文中一共展示了X509Name.getOIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDadesCertificat
import org.bouncycastle.asn1.x509.X509Name; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "resource" })
private DadesCertificat getDadesCertificat(X509Certificate cert) throws Exception {
ASN1InputStream asn1is = new ASN1InputStream(cert.getEncoded());
org.bouncycastle.asn1.DERObject obj = asn1is.readObject();
/*byte[] value = cert.getExtensionValue(X509Extensions.BasicConstraints.toString());
BasicConstraints basicConstraints = new BasicConstraints(cert.getBasicConstraints());
if (basicConstraints.isCA())
return null;*/
DadesCertificat resposta = new DadesCertificat();
X509CertificateStructure certificate = new X509CertificateStructure((ASN1Sequence)obj);
X509Name name = certificate.getSubject();
Vector oids = name.getOIDs();
Vector values = name.getValues();
for (int i = 0; i < oids.size(); i++) {
if (oids.get(i).equals(X509Name.CN)) {
processName(values.get(i).toString(), resposta);
} else if (oids.get(i).equals(X509Name.SURNAME)) {
resposta.setApellidosResponsable(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.GIVENNAME)) {
resposta.setNombreResponsable(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.SN)) {
resposta.setNifCif(values.get(i).toString());
resposta.setNifResponsable(values.get(i).toString());
} else if (oids.get(i).equals(OID_NIF_RESPONSABLE)) {
resposta.setNifResponsable(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.EmailAddress)) {
resposta.setEmail(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.C)) {
//resposta.setPais(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.O)) {
resposta.setRazonSocial(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.OU)) {
//resposta.setDepartament(values.get(i).toString());
} else if (oids.get(i).equals(X509Name.T)) {
//resposta.setCarrec(values.get(i).toString());
}
}
return resposta;
}
示例2: DatosCertificado
import org.bouncycastle.asn1.x509.X509Name; //导入方法依赖的package包/类
public DatosCertificado(X509Certificate cert) throws Exception{
byte b[] = cert.getEncoded();
ASN1InputStream asn1is = new ASN1InputStream(b);
org.bouncycastle.asn1.DERObject obj = asn1is.readObject();
X509CertificateStructure certificate = new X509CertificateStructure((ASN1Sequence)obj);
X509Name name = certificate.getSubject();
personaFisica = false;
personaJuridica = false;
Vector v = name.getOIDs();
Vector value = name.getValues();
for(int i = 0; i < v.size(); i++)
{
if(v.get(i).equals(X509Name.CN))
processName(value.get(i).toString());
if(v.get(i).equals(X509Name.SURNAME))
surName = value.get(i).toString();
if(v.get(i).equals(X509Name.GIVENNAME))
givenName = value.get(i).toString();
if(v.get(i).equals(X509Name.CN))
processName(value.get(i).toString());
if(v.get(i).equals(X509Name.SN))
{
nif = value.get(i).toString();
if(!personaJuridica)
personaFisica = true;
}
if(v.get(i).equals(NIFOID))
{
nifResponsable = v.get(i).toString();
personaFisica = false;
personaJuridica = true;
}
}
}