mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/MessageRouterImpl.java
private boolean confirmSafeDecryption(final TerraHarvestMessage message, final RemoteChannel channel)
    {
        final EncryptType currentSysEncryptType = 
                EnumConverter.convertEncryptionModeToEncryptType(m_RemoteSettings.getEncryptionMode());
        final EncryptType messageEncryptType = message.getEncryptType();
        
        if (currentSysEncryptType.getNumber() > messageEncryptType.getNumber())
        { 
            try
            {
                if (checkMessageForEncryptionInfo(message, messageEncryptType))
                {
                    return true;
                }
            }
            catch (final InvalidProtocolBufferException ex)
            {
                m_Log.error(ex, "Invalid TerraHarvestPayload with messageID, channel info: %d %s", 
                        message.getMessageId(), channel);
                final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil.buildErrorResponseMessage(message, 
                        ErrorCode.INVALID_REQUEST, 
                        "Invalid payload exception when handling a message");
                channel.queueMessage(errorMessage);
                return false;
            }
            
            //not supported the level of the message must meet or exceed the current security/encryption level
            //of this system.
            m_Log.error("Received message from %d, the message had invalid encryption data", 
                    message.getSourceId());
            final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil.buildEncryptionErrorResponseMessage(
                    message, EncryptionErrorCode.INVALID_ENCRYPTION_LEVEL, String.format("System %d does not support " 
                            + "type %s encryption.", m_TerraHarvestSystem.getId(), message.getEncryptType().toString()),
                            m_RemoteSettings.getEncryptionMode());
            channel.queueMessage(errorMessage);
            return false;
        }
        return true;
    }
/**
     * Confirm that it is safe to decrypt a message. If a request comes through for information from this system
     * that information must be encrypted to a level that meets or exceeds the encryption level of this system.
     *  **NOTE that the 'level' is correlated to the proto enum ordinal value.
     * @param message
     *      the terra harvest message that needs to be evaluated
     * @param channel
     *      the {@link RemoteChannel} used to send error messages
     * @return
     *      True if the message is safe to decrypt and false otherwise.
     */
Confirm that it is safe to decrypt a message. If a request comes through for information from this system
that information must be encrypted to a level that meets or exceeds the encryption level of this system.
NOTE that the 'level' is correlated to the proto enum ordinal value.
@param message
the terra harvest message that needs to be evaluated
@param channel
the  RemoteChannel used to send error messages
@return
True if the message is safe to decrypt and false otherwise.
Confirm that it is safe to decrypt a message . If a request comes through for information from this system that information must be encrypted to a level that meets or exceeds the encryption level of this system . NOTE that the ' level ' is correlated to the proto enum ordinal value . @param message the terra harvest message that needs to be evaluated @param channel the RemoteChannel used to send error messages @return True if the message is safe to decrypt and false otherwise .
private boolean confirmSafeDecryption(final TerraHarvestMessage message, final RemoteChannel channel)
    {
        final EncryptType currentSysEncryptType = 
                EnumConverter.convertEncryptionModeToEncryptType(m_RemoteSettings.getEncryptionMode());
        final EncryptType messageEncryptType = message.getEncryptType();
        if (currentSysEncryptType.getNumber() > messageEncryptType.getNumber())
        { 
            try
            {
                if (checkMessageForEncryptionInfo(message, messageEncryptType))
                {
                    return true;
                }
            }
            catch (final InvalidProtocolBufferException ex)
            {
                m_Log.error(ex, "Invalid TerraHarvestPayload with messageID, channel info: %d %s", 
                        message.getMessageId(), channel);
                final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil.buildErrorResponseMessage(message, 
                        ErrorCode.INVALID_REQUEST, 
                        "Invalid payload exception when handling a message");
                channel.queueMessage(errorMessage);
                return false;
            }
            m_Log.error("Received message from %d, the message had invalid encryption data", 
                    message.getSourceId());
            final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil.buildEncryptionErrorResponseMessage(
                    message, EncryptionErrorCode.INVALID_ENCRYPTION_LEVEL, String.format("System %d does not support " 
                            + "type %s encryption.", m_TerraHarvestSystem.getId(), message.getEncryptType().toString()),
                            m_RemoteSettings.getEncryptionMode());
            channel.queueMessage(errorMessage);
            return false;
        }
        return true;
    }
private boolean confirmSafeDecryption ( final TerraHarvestMessage message , final RemoteChannel channel ) { final EncryptType currentSysEncryptType = EnumConverter . convertEncryptionModeToEncryptType ( m_RemoteSettings . getEncryptionMode ( ) ) ; final EncryptType messageEncryptType = message . getEncryptType ( ) ; if ( currentSysEncryptType . getNumber ( ) > messageEncryptType . getNumber ( ) ) { try { if ( checkMessageForEncryptionInfo ( message , messageEncryptType ) ) { return true ; } } catch ( final InvalidProtocolBufferException ex ) { m_Log . error ( ex , "Invalid TerraHarvestPayload with messageID, channel info: %d %s" , message . getMessageId ( ) , channel ) ; final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil . buildErrorResponseMessage ( message , ErrorCode . INVALID_REQUEST , "Invalid payload exception when handling a message" ) ; channel . queueMessage ( errorMessage ) ; return false ; } m_Log . error ( "Received message from %d, the message had invalid encryption data" , message . getSourceId ( ) ) ; final TerraHarvestMessage errorMessage = TerraHarvestMessageUtil . buildEncryptionErrorResponseMessage ( message , EncryptionErrorCode . INVALID_ENCRYPTION_LEVEL , String . format ( "System %d does not support " + "type %s encryption." , m_TerraHarvestSystem . getId ( ) , message . getEncryptType ( ) . toString ( ) ) , m_RemoteSettings . getEncryptionMode ( ) ) ; channel . queueMessage ( errorMessage ) ; return false ; } return true ; }
Confirm that it is safe to decrypt a message.
Confirm that it is safe to decrypt a message .
//not supported the level of the message must meet or exceed the current security/encryption level //of this system.