当前位置: 首页>>代码示例>>Java>>正文


Java X509Name.getOIDs方法代码示例

本文整理汇总了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;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:40,代码来源:SignaturaPluginTest.java

示例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;
          }
      }

}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:36,代码来源:DatosCertificado.java


注:本文中的org.bouncycastle.asn1.x509.X509Name.getOIDs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。