[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-ssl] smime problem




Hi all.

I'm sending a smime message with de above code and get the exception:

Notify: error al mandar email: javax.mail.SendFailedException: Sending
failed

File mailcap is in <JDK>/lib

What is grown?? Thanks in advance

   Properties props = new Properties();
   props.put("mail.smtp.host", snmphost);
   Session session = Session.getDefaultInstance(props, null);

  MimeMessage msg = new MimeMessage(session);
  DataHandler multipart = null;
  try {
    MimeBodyPart mbp1 = new SMimeBodyPart();
    mbp1.setText("This is a Test of the IAIK S/MIME
implementation!\n\n");
    Multipart mp = new SMimeMultipart();
    mp.addBodyPart(mbp1);
    multipart = new DataHandler(mp, mp.getContentType());

   InternetAddress from = new InternetAddress("myaddres@um.es");
   msg.setFrom(from);
   msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("myaddres@um.es",false));
  msg.setSentDate(new Date());
 } catch (Exception e) {
     System.err.println("Notify : Error al añadir direccion" + e);
 };
    SignedContent sc = new SignedContent(false);

 try {
   if (accept) {
       msg.setSubject("Confirmation");
  } else msg.setSubject("Denied");
 } catch (Exception e) {
     System.err.println("Notify : Error al añadir subject");
     e.printStackTrace();
 };

 sc.setDataHandler(multipart);
    //sc.setText(message);
    X509Certificate []  signerCertificates = new X509Certificate[2];
    signerCertificates[0] = mycert;
    signerCertificates[0] = CAcert;
    sc.setCertificates(signerCertificates);

    try {
      sc.setSigner((RSAPrivateKey)privKey, mycert);
      msg.setContent(sc, sc.getContentType());
      Transport.send(msg);
    } catch (Exception ex) {
  System.err.println("Notify: error al mandar email: " + ex);
    }



--
Gabriel López Millán
Facultad de Informática -Universidad de Murcia
30001 Murcia - España (Spain)
Telf: +34-968-364644 E-mail: gabilm@dif.um.es



--
Mailinglist-archive at
http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content:
UNSUBSCRIBE iaik-ssl


***************************************************************************
*                                                                         *
* IAIK S/MIME Mapper Security Info                                        *
* ===================================                                     *
*                                                                         *
* for message:                                                            *
*   From: Gabriel Lopez <gabilm@dif.um.es>                                *
*   Date: Tue, 05 Dec 2000 19:42:36 +0100                                 *
*   Subject: [iaik-ssl] smime problem                                     *
*                                                                         *
* Message S/MIME properties:                                              *
*                                                                         *
*   Encrypted using:    not encrypted                                     *
*                                                                         *
*   Digitally signed:   no                                                *
*   Signature valid:    n/a                                               *
*   Signature trusted   n/a                                               *
*                                                                         *
*                                                                         *
* Compliance with policy for email addresses *:                           *
*                                                                         *
*   Encryption:         OK (None or better required)                      *
*                                                                         *
*   Digital Signature:  OK (digital signature not required)               *
*                                                                         *
***************************************************************************