Bruno Warmling
2013-04-25 10:51:36 UTC
Hi,
I want create one file with extension P7s, who contains inside one file PDF more some digital signatures, in detached form.
How can I set document name of PDF file?
I am trying using this code(C#):
byte[] textBytes = System.Text.Encoding.Unicode.GetBytes("test.pdf");
DerOctetString berOctetString = new DerOctetString(textBytes);
Org.BouncyCastle.Asn1.Cms.Attribute documentName = new Org.BouncyCastle.Asn1.Cms.Attribute(dnOid, new BerSet(berOctetString));
This code works, but when i get the encoded data and I tried convert to SignedCms using this code:
using System.Security.Cryptography;
System.Security.Cryptography.Pkcs.SignedCms signedData = new SignedCms();
signedData.Decode(p7sData);
var rawValue = signedData.SignerInfos()[0].SignedAttributes[0].RawValue;
Pkcs9DocumentName pkcs9DocumentName = new Pkcs9DocumentName(rawValue);
The result of (pkcs9DocumentName.DocumentName):
"test.pdfꮫꮫꮫꮫ"
what is this "ꮫꮫꮫꮫ" in document name? And how to solve this?
I need only "test.pdf", where "test" is a dummy name for my inside PDF.
I want create one file with extension P7s, who contains inside one file PDF more some digital signatures, in detached form.
How can I set document name of PDF file?
I am trying using this code(C#):
byte[] textBytes = System.Text.Encoding.Unicode.GetBytes("test.pdf");
DerOctetString berOctetString = new DerOctetString(textBytes);
Org.BouncyCastle.Asn1.Cms.Attribute documentName = new Org.BouncyCastle.Asn1.Cms.Attribute(dnOid, new BerSet(berOctetString));
This code works, but when i get the encoded data and I tried convert to SignedCms using this code:
using System.Security.Cryptography;
System.Security.Cryptography.Pkcs.SignedCms signedData = new SignedCms();
signedData.Decode(p7sData);
var rawValue = signedData.SignerInfos()[0].SignedAttributes[0].RawValue;
Pkcs9DocumentName pkcs9DocumentName = new Pkcs9DocumentName(rawValue);
The result of (pkcs9DocumentName.DocumentName):
"test.pdfꮫꮫꮫꮫ"
what is this "ꮫꮫꮫꮫ" in document name? And how to solve this?
I need only "test.pdf", where "test" is a dummy name for my inside PDF.