org.nhindirect.stagent
Class DefaultNHINDAgent

java.lang.Object
  extended by org.nhindirect.stagent.DefaultNHINDAgent
All Implemented Interfaces:
MutableAgent, NHINDAgent

public class DefaultNHINDAgent
extends Object
implements NHINDAgent, MutableAgent

Default agent implementation. Implements to support updating agent properties at runtime.

Since:
1.0
Author:
Greg Meyer, Umesh Madan

Constructor Summary
DefaultNHINDAgent(Collection<String> domains, CertificateResolver privateCerts, CertificateResolver publicCerts, TrustAnchorResolver anchors)
          Constructs an agent with a list of domains, certificate stores, and a trust anchor store.
DefaultNHINDAgent(Collection<String> domains, CertificateResolver privateCerts, CertificateResolver publicCerts, TrustAnchorResolver anchors, TrustModel trustModel, Cryptographer cryptographer)
          Constructs an agent with a list of domain, certificate services, and trust anchor store.
DefaultNHINDAgent(Collection<String> domains, CertificateResolver privateCerts, Collection<CertificateResolver> publicCerts, TrustAnchorResolver anchors, TrustModel trustModel, Cryptographer cryptographer)
          Constructs an agent with a list of domains, certificate stores, and a trust anchor store.
DefaultNHINDAgent(String domain, CertificateResolver privateCerts, CertificateResolver publicCerts, TrustAnchorResolver anchors)
          Constructs an agent with a domain, certificate stores, and a trust anchor store.
DefaultNHINDAgent(String domain, CertificateResolver privateCerts, CertificateResolver publicCerts, TrustAnchorResolver anchors, TrustModel trustModel, Cryptographer cryptographer)
          Constructs an agent with domain, certificate services, and trust anchor store.
 
Method Summary
 Cryptographer getCryptographer()
          Gets the Cryptographer used by the agent to perform cryptography operations.
 Collection<String> getDomains()
          Gets the list of domains that the agent is serving.
 NHINDAgentEventListener getEventListener()
          Sets the event listener that will receive notifications at different stages of message processing.
 TrustEnforcementStatus getMinTrustRequirement()
          Gets the minimum trust status applied to messages by the agent.
 CertificateResolver getPrivateCertResolver()
          Gets the certificate store used to decrypt and sign messages.
 CertificateResolver getPublicCertResolver()
          Deprecated. Use {getPublicCertResolvers()
 Collection<CertificateResolver> getPublicCertResolvers()
          Gets the certificate stores used to encrypt messages and validate signatures.
 TrustAnchorResolver getTrustAnchors()
          Gets the certificate store that contains the certificate anchors that validate if certificates are trusted.
 boolean isEncryptMessages()
          Indicates if messages are required to be encrypted in the agent.
 boolean isWrappingEnabled()
          Indicates if the agent automatically wraps messages into RFC822 envelopes for hiding headers.
 IncomingMessage processIncoming(IncomingMessage message)
          Processes a pre-enveloped message.
 IncomingMessage processIncoming(MessageEnvelope envelope)
          Processes a pre-enveloped message.
 IncomingMessage processIncoming(javax.mail.internet.MimeMessage msg)
          Processes an incoming mime message.
 IncomingMessage processIncoming(String messageText)
          Processes an incoming message represented by a raw string.
 IncomingMessage processIncoming(String messageText, NHINDAddressCollection recipients, NHINDAddress sender)
          Processes an incoming message represented by a raw string.
 OutgoingMessage processOutgoing(MessageEnvelope envelope)
          Processes an outgoing pre-enveloped message.
 OutgoingMessage processOutgoing(OutgoingMessage message)
          Processes an outgoing pre-enveloped message.
 OutgoingMessage processOutgoing(String messageText)
          Processes an outgoing message represented by a raw string.
 OutgoingMessage processOutgoing(String messageText, NHINDAddressCollection recipients, NHINDAddress sender)
          Processes an outgoing message represented by a raw string.
 void setCryptographer(Cryptographer cryptographer)
          Sets the Cryptographer used by the agent to perform cryptography operations.
 void setDomains(Collection<String> domains)
          Sets the list of domain that the agent is serving.
 void setEncryptMessages(boolean value)
          Sets if messages are required to be encrypted in the agen
 void setEventListener(NHINDAgentEventListener listener)
          Sets the event listener that will receive notifications at different stages of message processing.
 void setMinTrustRequirement(TrustEnforcementStatus value)
          Sets the minimum trust status applied to messages by the agent.
 void setPrivateCertResolver(CertificateResolver resolver)
          Sets the certificate store used to decrypt and sign messages.
 void setPublicCertResolvers(Collection<CertificateResolver> resolvers)
          Sets the certificate stores used to encrypt messages and validate signatures.
 void setTrustAnchorResolver(TrustAnchorResolver resolver)
          Sets the certificate store that contains the certificate anchors that validate if certificates are trusted.
 void setWrappingEnabled(boolean wrappingEnabled)
          Sets the auto message wrapping feature of the agent.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNHINDAgent

public DefaultNHINDAgent(String domain,
                         CertificateResolver privateCerts,
                         CertificateResolver publicCerts,
                         TrustAnchorResolver anchors)
Constructs an agent with a domain, certificate stores, and a trust anchor store.

Parameters:
domain - The domain that this agent will be serving.
internalCerts - A certificate store for messages originating internally. The store contains certificates that have access to private keys for decryption and signing messages.
externalCerts - A certificate store for incoming messages. The store contains public certificates for message signature validation and encryption.
trustSettings - A certificate store for certificate anchors. Certificate anchors are certificates that can validate the authenticity of a certificate. They are also used by the agent to determine if a certificate is trusted by the system.

DefaultNHINDAgent

public DefaultNHINDAgent(Collection<String> domains,
                         CertificateResolver privateCerts,
                         CertificateResolver publicCerts,
                         TrustAnchorResolver anchors)
Constructs an agent with a list of domains, certificate stores, and a trust anchor store.

Parameters:
domain - A list of domains that this agent will be serving.
internalCerts - A certificate store for messages originating internally. The store contains certificates that have access to private keys for decryption and signing messages.
externalCerts - A certificate store for incoming messages. The store contains public certificates for message signature validation and encryption.
trustSettings - A certificate store for certificate anchors. Certificate anchors are certificates that can validate the authenticity of a certificate. They are also used by the agent to determine if a certificate is trusted by the system.

DefaultNHINDAgent

public DefaultNHINDAgent(String domain,
                         CertificateResolver privateCerts,
                         CertificateResolver publicCerts,
                         TrustAnchorResolver anchors,
                         TrustModel trustModel,
                         Cryptographer cryptographer)
Constructs an agent with domain, certificate services, and trust anchor store.

Parameters:
domain - The domain that this agent will be serving.
internalCerts - A certificate store for messages originating internally. The store contains certificates that have access to private keys for decryption and signing messages.
externalCerts - A certificate store for incoming messages. The store contains public certificates for message signature validation and encyprtion.
trustSettings - A certificate store for certificate anchors. Certificate anchors are certificates that can validate the authenticity of a certificate. They are also used by the agent to determine if a certificate is trusted by the system.
A - trust model implementation that asserts the if a message is trusted.
A - cryptography implementation used to sign, encrypt, and decrypt messages.

DefaultNHINDAgent

@Inject
public DefaultNHINDAgent(Collection<String> domains,
                                CertificateResolver privateCerts,
                                Collection<CertificateResolver> publicCerts,
                                TrustAnchorResolver anchors,
                                TrustModel trustModel,
                                Cryptographer cryptographer)
Constructs an agent with a list of domains, certificate stores, and a trust anchor store.


DefaultNHINDAgent

public DefaultNHINDAgent(Collection<String> domains,
                         CertificateResolver privateCerts,
                         CertificateResolver publicCerts,
                         TrustAnchorResolver anchors,
                         TrustModel trustModel,
                         Cryptographer cryptographer)
Constructs an agent with a list of domain, certificate services, and trust anchor store.

Parameters:
domain - A list of domains that this agent will be serving.
internalCerts - A certificate store for messages originating internally. The store contains certificates that have access to private keys for decryption and signing messages.
externalCerts - A certificate store for incoming messages. The store contains public certificates for message signature validation and encyprtion.
trustSettings - A certificate store for certificate anchors. Certificate anchors are certificates that can validate the authenticity of a certificate. They are also used by the agent to determine if a certificate is trusted by the system.
A - trust model implementation that asserts the if a message is trusted.
A - cryptography implementation used to sign, encrypt, and decrypt messages.
Method Detail

setDomains

public void setDomains(Collection<String> domains)
Sets the list of domain that the agent is serving.

Specified by:
setDomains in interface MutableAgent
Parameters:
domains - The list of domain that the agent is serving.

getDomains

public Collection<String> getDomains()
Gets the list of domains that the agent is serving.

Specified by:
getDomains in interface MutableAgent
Specified by:
getDomains in interface NHINDAgent
Returns:
The domains that the agent is serving.

getCryptographer

public Cryptographer getCryptographer()
Gets the Cryptographer used by the agent to perform cryptography operations.

Specified by:
getCryptographer in interface MutableAgent
Returns:
The Cryptographer used by the agent to perform cryptography operations.

setCryptographer

public void setCryptographer(Cryptographer cryptographer)
Sets the Cryptographer used by the agent to perform cryptography operations.

Specified by:
setCryptographer in interface MutableAgent
Parameters:
cryptographer - The Cryptographer used by the agent to perform cryptography operations.

isEncryptMessages

public boolean isEncryptMessages()
Indicates if messages are required to be encrypted in the agent.

Returns:
True if messages are required to be encrypted in the agent. False otherwise.

setEncryptMessages

public void setEncryptMessages(boolean value)
Sets if messages are required to be encrypted in the agen

Parameters:
value - True if messages are required to be encrypted in the agent. False otherwise.

isWrappingEnabled

public boolean isWrappingEnabled()
Indicates if the agent automatically wraps messages into RFC822 envelopes for hiding headers.

Specified by:
isWrappingEnabled in interface MutableAgent
Returns:
True if the agent automatically wraps messages.

setWrappingEnabled

public void setWrappingEnabled(boolean wrappingEnabled)
Sets the auto message wrapping feature of the agent. Message wrapping takes the original message and wraps it into a message of type RFC822 pushing all headers into the message body. Only routing information is propagated up from the original message.

Specified by:
setWrappingEnabled in interface MutableAgent
Parameters:
wrappingEnabled - True if the agent automatically wraps messages. False otherwise.

getPublicCertResolver

public CertificateResolver getPublicCertResolver()
Deprecated. Use {getPublicCertResolvers()

Gets the certificate store used to encrypt messages and validate signatures. This store generally contains only public certificates

Returns:
The certificate store used to encrypt messages and validate signatures.

getPublicCertResolvers

public Collection<CertificateResolver> getPublicCertResolvers()
Gets the certificate stores used to encrypt messages and validate signatures. This store generally contains only public certificates

Specified by:
getPublicCertResolvers in interface MutableAgent
Returns:
The certificate stores used to encrypt messages and validate signatures.

setPublicCertResolvers

public void setPublicCertResolvers(Collection<CertificateResolver> resolvers)
Sets the certificate stores used to encrypt messages and validate signatures. This store generally contains only public certificates

Specified by:
setPublicCertResolvers in interface MutableAgent
Parameters:
resolvers - The certificate stores used to encrypt messages and validate signatures.

getPrivateCertResolver

public CertificateResolver getPrivateCertResolver()
Gets the certificate store used to decrypt and sign messages. Certificates in this store must have access to the certifcate's private key.

Specified by:
getPrivateCertResolver in interface MutableAgent
Returns:
The certificate store used to decrypt and sign messages.

setPrivateCertResolver

public void setPrivateCertResolver(CertificateResolver resolver)
Sets the certificate store used to decrypt and sign messages. Certificates in this store must have access to the certifcate's private key.

Specified by:
setPrivateCertResolver in interface MutableAgent
Parameters:
resolver - The certificate store used to decrypt and sign messages.

getTrustAnchors

public TrustAnchorResolver getTrustAnchors()
Gets the certificate store that contains the certificate anchors that validate if certificates are trusted.

Specified by:
getTrustAnchors in interface MutableAgent
Returns:
The certificate store that contains the certificate anchors that validate if certificates are trusted.

setTrustAnchorResolver

public void setTrustAnchorResolver(TrustAnchorResolver resolver)
Sets the certificate store that contains the certificate anchors that validate if certificates are trusted.

Specified by:
setTrustAnchorResolver in interface MutableAgent
Parameters:
resolver - The certificate store that contains the certificate anchors that validate if certificates are trusted.

getMinTrustRequirement

public TrustEnforcementStatus getMinTrustRequirement()
Gets the minimum trust status applied to messages by the agent.

Returns:
The minimum trust status applied to messages by the agent.

setMinTrustRequirement

public void setMinTrustRequirement(TrustEnforcementStatus value)
Sets the minimum trust status applied to messages by the agent.

Parameters:
value - The minimum trust status applied to messages by the agent.

setEventListener

public void setEventListener(NHINDAgentEventListener listener)
Sets the event listener that will receive notifications at different stages of message processing.

Specified by:
setEventListener in interface MutableAgent
Parameters:
listener - A concrete implementation of an NHINDAgentEventListener.

getEventListener

public NHINDAgentEventListener getEventListener()
Sets the event listener that will receive notifications at different stages of message processing.

Specified by:
getEventListener in interface MutableAgent
Returns:
A concrete implementation of an NHINDAgentEventListener.

processIncoming

public IncomingMessage processIncoming(String messageText)
Processes an incoming message represented by a raw string. The message will be decrypted and validated that it meets trust assertions.

Specified by:
processIncoming in interface NHINDAgent
Parameters:
messageText - The raw contents of the incoming message that will be processed.
Returns:
An incoming messaging object that contains the unwrapped and decrypted message.

processIncoming

public IncomingMessage processIncoming(String messageText,
                                       NHINDAddressCollection recipients,
                                       NHINDAddress sender)
Processes an incoming message represented by a raw string. The message will be decrypted and validated that it meets trust assertions.

Specified by:
processIncoming in interface NHINDAgent
Parameters:
messageText - The raw contents of the incoming message that will be processed.
recipients - The recipients of the message. This overrides the routing headers in the message.
sender - The sender of the message. This overrides the to FROM routing header in the message.
Returns:
An incoming messaging object that contains the unwrapped and decrypted message.

processIncoming

public IncomingMessage processIncoming(MessageEnvelope envelope)
Processes a pre-enveloped message. The message will be decrypted and validated that it meets trust assertions.

Specified by:
processIncoming in interface NHINDAgent
Parameters:
envelope - A message envelope containing the incoming message.
Returns:
An incoming messaging object that contains the unwrapped and decrypted message.

processIncoming

public IncomingMessage processIncoming(javax.mail.internet.MimeMessage msg)
Processes an incoming mime message. The message will be decrypted and validated that it meets trust assertions.

Specified by:
processIncoming in interface NHINDAgent
Parameters:
msg - The incoming mime message.
Returns:
An incoming messaging object that contains the unwrapped and decrypted message.

processIncoming

public IncomingMessage processIncoming(IncomingMessage message)
Processes a pre-enveloped message. The message will be decrypted and validated that it meets trust assertions.

Specified by:
processIncoming in interface NHINDAgent
Parameters:
envelope - A message envelope containing the incoming message.
Returns:
An incoming messaging object that contains the unwrapped and decrypted message.

processOutgoing

public OutgoingMessage processOutgoing(String messageText)
Processes an outgoing message represented by a raw string. The message will be wrapped, encrypted, and signed.

Specified by:
processOutgoing in interface NHINDAgent
Parameters:
messageText - The raw contents of the incoming message that will be processed.
Returns:
An outoing messaging object that contains the wrapped message that is and encrypted and signed.

processOutgoing

public OutgoingMessage processOutgoing(String messageText,
                                       NHINDAddressCollection recipients,
                                       NHINDAddress sender)
Processes an outgoing message represented by a raw string. The message will be wrapped, encrypted, and signed.

Specified by:
processOutgoing in interface NHINDAgent
Parameters:
messageText - The raw contents of the incoming message that will be processed.
recipients - The recipients of the message. This overrides the routing headers in the message.
sender - The sender of the message. This overrides the to FROM routing header in the message.
Returns:
An outoing messaging object that contains the wrapped message that is and encrypted and signed.

processOutgoing

public OutgoingMessage processOutgoing(MessageEnvelope envelope)
Processes an outgoing pre-enveloped message. The message will be wrapped, encrypted, and signed.

Specified by:
processOutgoing in interface NHINDAgent
Parameters:
envelope - A message envelope containing the outgoing message.
Returns:
An outoing messaging object that contains the wrapped message that is and encrypted and signed.

processOutgoing

public OutgoingMessage processOutgoing(OutgoingMessage message)
Processes an outgoing pre-enveloped message. The message will be wrapped, encrypted, and signed.

Specified by:
processOutgoing in interface NHINDAgent
Parameters:
message - A message envelope containing the incoming message.
Returns:
An outoing messaging object that contains the wrapped message that is and encrypted and signed.


Copyright © 2010-2012 HNIN Direct. All Rights Reserved.