/** * {@inheritDoc}} */ public void enforce(OutgoingMessage message) { if (message == null) { throw new IllegalArgumentException(); } NHINDAddress sender = message.getSender(); NHINDAddressCollection recipients = message.getRecipients(); for (NHINDAddress recipient : recipients) { recipient.setStatus(TrustEnforcementStatus.Failed); Collection<X509Certificate> certs = recipient.getCertificates(); if (certs == null || certs.size() == 0) LOGGER.warn("enforce(OutgoingMessage message) - recipient " + recipient.getAddress() + " has no bound certificates"); recipient.setCertificates(findTrustedCerts(certs, sender.getTrustAnchors())); if (recipient.hasCertificates()) recipient.setStatus(TrustEnforcementStatus.Success); else LOGGER.warn("enforce(OutgoingMessage message) - could not trust any certificates for recipient " + recipient.getAddress()); } }
message.getSender().setCertificates(privateCerts); recipient.setCertificates(publicCerts);
message.getSender().setCertificates(new ArrayList<X509Certificate>()); LOGGER.warn("bindAddresses(IncomingMessage message) - Could not resolve a private certificate for recipient " + recipient.getAddress()); recipient.setCertificates(privateCerts);