[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] extract original file name from CMS
From:       "Marcelo Alarcon " <malarcon () bcu ! gub ! uy>
Date:       2008-10-23 17:50:55
Message-ID: s9009ca1.015 () BCUMAIL ! lan ! bcu ! gub ! uy
[Download RAW message or body]

Thanks David
 
The filename is stored as a signer attribute. We have an application written in \
delphi that reads the file name according to the following code:    
attrs := signer.AuthenticatedAttributes;
for n:=1 to attrs.Count do
begin
  if (attrs.Item[n].Name = CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME) then 
    documentName := attrs.Item[n].Value;
end;

 
We want to do the same with de following java code but the value of the attribute is \
not readable:  
for (Iterator it = cms.getSignerInfos().getSigners().iterator(); it
    .hasNext();) {
 
  SignerInformation signerInformation = (SignerInformation) it.next();
 
  SignerInfo signerInfo = signerInformation.toSignerInfo();
 
  ASN1Set authenticatedAttributes = signerInfo
      .getAuthenticatedAttributes();
 
  for (Enumeration enu = authenticatedAttributes.getObjects(); enu
      .hasMoreElements();) {
    DERSequence attribute = (DERSequence) enu.nextElement();
    logger.info("attribute=" + attribute);
  }
}
 
 
the output is:
 
attribute=[1.3.6.1.4.1.311.88.2.2, [#]]
attribute=[1.2.840.113549.1.9.3, [1.2.840.113549.1.7.1]]
attribute=[1.2.840.113549.1.9.5, [071022182628Z]]
attribute=[1.2.840.113549.1.9.4, [#144a30cf9be097c72890ace4bc89fd4e0cefcf36]]
attribute=[1.3.6.1.4.1.311.88.2.1, \
[#320030002e0020005700650062005300650072007600690063006500730020004a006100760061002e00700064006600]]


 
Regards,
 
Marcelo
 
 
Ing. Wilman Marcelo Alarcón 
Área Sistemas de Información
Banco Central del Uruguay
malarcon@bcu.gub.uy 
tel: (5982)  1967 2066 o 1967 2068

> > > David Hook <dgh@lockboxlabs.com> 22/10/2008 21:23 >>>


Unless the file name has been stored as an attribute, there is no
provision for this information (i.e. it needs to be explicitly added)

regards,

David

On Wed, 2008-10-22 at 16:40 -0300, Marcelo Alarcon wrote:
> I am using Bouncy Castle version 1.37.0  and java 1.5. I would like
> to know how can I extract the original document file name from a CMS
> signed file?
> 
> Thanks 
> 
> Marcelo. 
> 
> 
> Ing. Wilman Marcelo Alarcón 
> Área Sistemas de Información
> Banco Central del Uruguay
> malarcon@bcu.gub.uy 
> tel: (5982)  1967 2066 o 1967 2068
> --------------------------------------------------------------------------------------------------------------------------- \
>  
> La información contenida en este mensaje es para uso exclusivo del
> destinatario y demás autorizados a recibirla. Si usted ha recibido
> este e-mail por error, comuníquelo inmediatamente por esta vía y
> elimínelo de su sistema. Si Ud. no es el destinatario especificado en
> el mensaje, cualquier revelación, copia o distribución de su contenido
> está estrictamente prohibido. El mensaje expresa la opinión de su
> autor pero no necesariamente expresa la opinión oficial del Banco
> Central del Uruguay. 
> 
> The information included on this message is intended only for the
> personal and confidential use of the designated recipient(s) named
> above. If you have received it by mistake please let us know by e-mail
> immediately and destroy or delete it from your files or system. If you
> are not the designated recipient, any disclose, copy or distribution
> of its contents is prohibited. This message reflects the opinion of
> its author but not necessarily express an official statement of the
> BCU.
> 




---------------------------------------------------------------------------------------------------------------------------------------


La información contenida en este mensaje es para uso exclusivo del destinatario y \
demás autorizados a recibirla. Si usted ha recibido este e-mail por error, \
comuníquelo inmediatamente por esta vía y elimínelo de su sistema. Si Ud. no es el \
destinatario especificado en el mensaje, cualquier revelación, copia o distribución \
de su contenido está estrictamente prohibido. El mensaje expresa la opinión de su \
autor pero no necesariamente expresa la opinión oficial del Banco Central del \
Uruguay.

The information included on this message is intended only for the personal and \
confidential use of the designated recipient(s) named above. If you have received it \
by mistake please let us know by e-mail immediately and destroy or delete it from \
your files or system. If you are not the designated recipient, any disclose, copy or \
distribution of its contents is prohibited. <<>>


[Attachment #3 (text/html)]

<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Thanks David</DIV>
<DIV>&nbsp;</DIV>
<DIV>The filename is stored as a signer attribute. We have an application written in \
delphi that&nbsp;reads the file name according to&nbsp;the following code: \
&nbsp;</DIV> <DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New">attrs := signer.AuthenticatedAttributes;<BR>for n:=1 to \
attrs.Count do<BR>begin<BR>&nbsp; if (attrs.Item[n].Name = \
CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME) then <BR>&nbsp;&nbsp;&nbsp; \
documentName := attrs.Item[n].Value;<BR>end;</FONT><BR></DIV> <DIV>&nbsp;</DIV>
<DIV>We want to do the same with de following java code but the value of the \
attribute is not readable:</DIV> <DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New">for (Iterator it = \
cms.getSignerInfos().getSigners().iterator(); it<BR>&nbsp;&nbsp;&nbsp; .hasNext();) \
{</FONT></DIV> <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New">&nbsp; SignerInformation signerInformation = \
(SignerInformation) it.next();</FONT></DIV> <DIV><FONT face="Courier \
New"></FONT>&nbsp;</DIV> <DIV><FONT face="Courier New">&nbsp; SignerInfo signerInfo = \
signerInformation.toSignerInfo();</FONT></DIV> <DIV><FONT face="Courier \
New"></FONT>&nbsp;</DIV> <DIV><FONT face="Courier New">&nbsp; ASN1Set \
authenticatedAttributes = signerInfo<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
.getAuthenticatedAttributes();</FONT></DIV> <DIV><FONT face="Courier \
New"></FONT>&nbsp;</DIV> <DIV><FONT face="Courier New">&nbsp; for (Enumeration enu = \
authenticatedAttributes.getObjects(); enu<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
.hasMoreElements();) {<BR>&nbsp;&nbsp;&nbsp; DERSequence attribute = (DERSequence) \
enu.nextElement();<BR>&nbsp;&nbsp;&nbsp; logger.info("attribute=" + \
attribute);<BR>&nbsp; }<BR>}</FONT></DIV> <DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>the output is:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New">attribute=[1.3.6.1.4.1.311.88.2.2, \
[#]]<BR>attribute=[1.2.840.113549.1.9.3, \
[1.2.840.113549.1.7.1]]<BR>attribute=[1.2.840.113549.1.9.5, \
[071022182628Z]]<BR>attribute=[1.2.840.113549.1.9.4, \
[#144a30cf9be097c72890ace4bc89fd4e0cefcf36]]<BR>attribute=[1.3.6.1.4.1.311.88.2.1, \
[#320030002e0020005700650062005300650072007600690063006500730020004a006100760061002e00700064006600]]<BR></FONT></DIV>
 <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Marcelo</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Ing. Wilman Marcelo Alarcón <BR>Área Sistemas de Información<BR>Banco Central \
del Uruguay<BR><A href="mailto:malarcon@bcu.gub.uy">malarcon@bcu.gub.uy</A><BR>tel: \
(5982)&nbsp; 1967 2066 o 1967 2068<BR><BR>&gt;&gt;&gt; David Hook \
&lt;dgh@lockboxlabs.com&gt; 22/10/2008 21:23 &gt;&gt;&gt;<BR></DIV> <DIV \
style="COLOR: #000000"><BR>Unless the file name has been stored as an attribute, \
there is no<BR>provision for this information (i.e. it needs to be explicitly \
added)<BR><BR>regards,<BR><BR>David<BR><BR>On Wed, 2008-10-22 at 16:40 -0300, Marcelo \
Alarcon wrote:<BR>&gt; I am using Bouncy Castle version 1.37.0&nbsp; and java 1.5. I \
would like<BR>&gt; to know how can I extract the original document file name from a \
CMS<BR>&gt; signed file?<BR>&gt;&nbsp; <BR>&gt; Thanks <BR>&gt;&nbsp; <BR>&gt; \
Marcelo. <BR>&gt;&nbsp; <BR>&gt;&nbsp; <BR>&gt; Ing. Wilman Marcelo Alarcón <BR>&gt; \
Área Sistemas de Información<BR>&gt; Banco Central del Uruguay<BR>&gt; \
malarcon@bcu.gub.uy<BR>&gt; tel: (5982)&nbsp; 1967 2066 o 1967 2068<BR>&gt; \
--------------------------------------------------------------------------------------------------------------------------- \
<BR>&gt; <BR>&gt; La información contenida en este mensaje es para uso exclusivo \
del<BR>&gt; destinatario y demás autorizados a recibirla. Si usted ha \
recibido<BR>&gt; este e-mail por error, comuníquelo inmediatamente por esta vía \
y<BR>&gt; elimínelo de su sistema. Si Ud. no es el destinatario especificado \
en<BR>&gt; el mensaje, cualquier revelación, copia o distribución de su \
contenido<BR>&gt; está estrictamente prohibido. El mensaje expresa la opinión de \
su<BR>&gt; autor pero no necesariamente expresa la opinión oficial del Banco<BR>&gt; \
Central del Uruguay. <BR>&gt; <BR>&gt; The information included on this message is \
intended only for the<BR>&gt; personal and confidential use of the designated \
recipient(s) named<BR>&gt; above. If you have received it by mistake please let us \
know by e-mail<BR>&gt; immediately and destroy or delete it from your files or \
system. If you<BR>&gt; are not the designated recipient, any disclose, copy or \
distribution<BR>&gt; of its contents is prohibited. This message reflects the opinion \
of<BR>&gt; its author but not necessarily express an official statement of \
the<BR>&gt; BCU.<BR>&gt; <BR><BR><BR></DIV></BODY></HTML>

<p>---------------------------------------------------------------------------------------------------------------------------&nbsp;


</p>

<p><font size="2" face="Times New Roman">
La información contenida en este mensaje es para uso exclusivo del destinatario y \
demás autorizados a recibirla. Si usted ha recibido este e-mail por error, \
comuníquelo inmediatamente por esta vía y elimínelo de su sistema. Si Ud. no es el \
destinatario especificado en el mensaje, cualquier revelación, copia o distribución \
de su contenido está estrictamente prohibido. El mensaje expresa la opinión de su \
autor pero no necesariamente expresa la opinión oficial del Banco Central del \
Uruguay.&nbsp;</font>

</p>

<p><font size="2" face="Times New Roman">

The information included on this message is intended only for the personal and \
confidential use of the designated recipient(s) named above. If you have received it \
by mistake please let us know by e-mail immediately and destroy or delete it from \
your files or system. If you are not the designated recipient, any disclose, copy or \
distribution of its contents is prohibited. This message reflects the opinion of its \
author but not necessarily express an official statement of the BCU.</font>

</p>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic