2

Получаю письма с прикрепленными файлами и все отлично работает, но если у отправителя есть цифровая подпись s/mime(p12), то в в письме я вижу две части, само письмо(меня оно не интересуют, т.к. важны файлы входящие) и файл smime.p7s . В котором как я предполагаю зашифрованы мои файлы, может кто сталкивался и есть способ расшифровать данный файл?

private ArrayList<Part> findRegisterAttachment(MimeMessage message)
        throws IOException, MessagingException, WrongMessageException {
    Multipart multipart = (Multipart) message.getContent();

    ArrayList<Part> parts = new ArrayList<>();

    for (int i = 0, n = multipart.getCount(); i < n; i++) {
        Part part = multipart.getBodyPart(i);

        String disposition = part.getDisposition();

        if ((disposition != null)
                && ((disposition.equals(Part.ATTACHMENT)) || (disposition
                .equals(Part.INLINE)))) {
            logger.debug("Found attachment part. Disposition: {}", disposition);

            logger.debug("Filtering with {}", attachmentFileFilter);

            String fileName = part.getFileName();
            if (StringUtils.isEmpty(fileName)) {
                logger.debug("Strange things happening!");
                continue;
            }

            if (attachmentFileFilter.accept(null, fileName)) {
                logger.debug("Found required attachment: {}", fileName);

                parts.add(part);
            } else {
                logger.debug("Filtered attachment: {}", fileName);
            }

        }

    }
    if (parts.isEmpty()) {
        throw new WrongMessageException("No register file attachment found in message: "
                + message.getSubject() + " from: " + mailBox);
    }

    return parts;
}

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.