LDicomNet::GetPeerMACISCL

#include "ltdic.h"

L_UINT32 LDicomNet::GetPeerMACISCL();

Returns a value that represents the MAC type the sender used when sending a message. This function is available in the Medical Suite toolkits.

Returns

Returns a value representing the current MAC type used by the sender. Possible values are:

Value

Meaning

DICOM_ISCL_MAC_NONE

No message authentication code was used.

DICOM_ISCL_MAC_MD5

A 128 bit MD5 message authentication code was transmitted with the message.

DICOM_ISCL_MAC_DESMAC

A 64 bit DESMAC authentication code was transmitted with the message.

Comments

This function returns a value that represents the type of MAC the sender used when sending a message to the receiver. If the type of MAC is not the same for the sender and the receiver, the message will not be sent successfully. If the encryption mode is not the same on the sender and the receiver, the message will not be sent successfully.

This function can only be called by the receiver, once the sender has attempted to send a message.

To set the MAC type, use the LDicomNet::SetDefaultSigningISCL function.

To set the encryption mode, use the LDicomNet::SetDefaultEncryptionISCL function.

The encryption mode and the MAC are specified for every message, not for each connection. Every message can have a different encryption mode and MAC, keeping the connection parameters unchanged.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LDicomNet::StartUp, LDicomNet::SetDefaultSigningISCL, LDicomNet::SetDefaultEncryptionISCL, LDicomNet::GetPeerEncryptionISCL, LDicomNet::GetPeerAuthDataISCL, LDicomNet::GetPeerRequestedMessageLengthISCL, Class Members

Topics:

Sending and Receiving Messages

 

General Integrated Secure Communication Layer (ISCL) Information

Example

// LMyDicomNet is a class derived from LDicomNet

/*<struct>*/
#ifdef LMYDICOMNETEXT1
class LMyDicomNetExt1 : public LDicomNet
   {
   public:
      L_INT m_nProcess;
      L_INT m_nClientOrServer;
      L_INT m_nDataCommand;
      L_INT m_FileCount;
      LMyDicomNetExt1 (L_TCHAR *pszPath, L_INT32 nMode);
      LMyDicomNetExt1 (L_TCHAR *pszPath, L_INT32 nMode, L_BOOL bReserved);
      virtual ~LMyDicomNetExt1 ();
      L_VOID    LMyDicomNetExt1::OnReceive(L_INT nError, L_UCHAR nType, L_UCHAR *pBuffer, L_UINT32 nBytes);//GetPeerMACISCL*/
   };
#endif
/*</struct>*/
void LMyDicomNetExt1::OnReceive(L_INT nError, L_UCHAR nType, L_UCHAR *pBuffer, L_UINT32 nBytes)
{
   UNREFERENCED_PARAMETER(nBytes);
   UNREFERENCED_PARAMETER(nType);
   UNREFERENCED_PARAMETER(pBuffer);
   if (nError == DICOM_ERROR_ISCL_MSG_TRANSMISSION)
   {
      L_TCHAR message[120], signalg[64];
      if(GetPeerMACISCL() == DICOM_ISCL_MAC_NONE)
         lstrcpy(signalg, TEXT("no message authentication code"));
      else if(GetPeerMACISCL() == DICOM_ISCL_MAC_MD5)
         lstrcpy(signalg, TEXT("MD5 algorithm"));
      else
         lstrcpy(signalg, TEXT("SHA algorithm"));
      wsprintf(message, TEXT("Sender tried to send a message with MAC %s"), signalg);
      AfxMessageBox(message);
   }
}