Pregunta

http: / /msdn.microsoft.com/en-us/library/system.security.cryptography.pkcs(VS.85).aspx podemos ver que los siguientes atributos de firma digital se definen:

  • Pkcs9ContentType
  • Pkcs9DocumentDescription
  • Pkcs9DocumentName
  • Pkcs9MessageDigest
  • Pkcs9SigningTime

De ellos, Pkcs9DocumentDescription y Pkcs9DocumentName no están presentes en el PKCS # 9 especificación. Tengo una aplicación Java que utiliza Castillo Hinchable y quiero que mi aplicación sea capaz de crear firmas digitales que tienen estos dos atributos.

Por lo tanto, tengo dos preguntas: ¿cómo hacerlo? Debería hacer eso?

¿Fue útil?

Solución

Vas a tener que construir manualmente los atributos usando los OID, así:

ObjectIdentifier dnOid = new ObjectIdentifier("1.3.6.1.4.1.311.88.2.1");
ObjectIdentifier ddOid = new ObjectIdentifier("1.3.6.1.4.1.311.88.2.2");
ASN1Set nameSet = new DERSet(new ASN1Encodable[] {new DERPrintableString("name")});
ASN1Set descriptionSet = new DERSet(new ASN1Encodable[] {new DERPrintableString("description"}));
Attribute documentName = new Attribute(dnOid, nameSet);
Attribute documentDescription = new Attribute(ddOid, descriptionSet);

Debo señalar que el uso de DERPrintableString para el valor del atributo es mi mejor conjetura. No puedo encontrar la documentación para indicar el tipo correcto.

debe usted , así, no hay nada malo con el uso de atributos que no son de PKCS #9. Simplemente no se debe confiar en un sistema externo de poder utilizarlas.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top