Package org.apache.james.jdkim.impl

Examples of org.apache.james.jdkim.impl.Message


     * @throws FailException
     *                 if no signature can be verified
     */
    public List<SignatureRecord> verify(InputStream is) throws IOException,
            FailException {
        Message message;
        try {
          try {
              message = new Message(is);
            } catch (RuntimeException e) {
              throw e;
            } catch (IOException e) {
              throw e;
            } catch (Exception e1) {
              // This can only be a MimeException but we don't declare to allow usage of
              // DKIMSigner without Mime4J dependency.
              throw new PermFailException("Mime parsing exception: "
                      + e1.getMessage(), e1);
          }
          try {
              return verify(message, message.getBodyInputStream());
          } finally {
              message.dispose();
          }
        } finally {
            is.close();
        }
    }
View Full Code Here


            throws PermFailException {
        return new BodyHasherImpl(signRecord);
    }

    public String sign(InputStream is) throws IOException, FailException {
        Message message;
        try {
            try {
                message = new Message(is);
            } catch (RuntimeException e) {
              throw e;
            } catch (IOException e) {
              throw e;
            } catch (Exception e1) {
              // This can only be a MimeException but we don't declare to allow usage of
              // DKIMSigner without Mime4J dependency.
                throw new PermFailException("MIME parsing exception: "
                        + e1.getMessage(), e1);
            }

            try {
                SignatureRecord srt = newSignatureRecordTemplate(signatureRecordTemplate);

                BodyHasher bhj = newBodyHasher(srt);

                // computation of the body hash.
                DKIMCommon.streamCopy(message.getBodyInputStream(), bhj
                        .getOutputStream());

                return sign(message, bhj);
            } finally {
                message.dispose();
            }

        } finally {
            is.close();
        }
View Full Code Here

TOP

Related Classes of org.apache.james.jdkim.impl.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.