Hello
Earlier we have been able to switch between Security.Authentication and Security.AuthenticationEncryption without any problem. When we needed to debug and use Wireshark to look at the DLMS data we used to set Security.Authentication, and in production we used Security.AuthenticationEncryption. But now when we switch to Security.Authentication we get the error "Connection is permanently rejected. Authentication is required". We use Gurux.DLMS version 8.5.1709.1901.
We are running against Kaifa meters, and when we use their tool SmartSet we send the data successfully without encryption. So it should be able to send without encryption with Gurux as well.
The reason why we want to run without encryption is because we need to see in Wireshark what we send when we try to set WeekProfile in the passive calendar in the meter. When we try this, we get the error "Device reports unmatched type". And when we set Week profile with Kaifas tool SmartSet we get no error. Maybe you have an idea why we get "Device reports unmatched type"?
I think I´ve found the problem why I can´t set Week profile in the meter. It was because the wrong DataType (Array) was set in GetWeekProfileTable(), When I changed to Structure it went ok.
static byte[] GetWeekProfileTable(GXDLMSSettings settings, GXDLMSWeekProfile[] target)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((byte)DataType.Array);
if (target == null)
{
//Add count
GXCommon.SetObjectCount(0, data);
}
else
{
int cnt = target.Length;
//Add count
GXCommon.SetObjectCount(cnt, data);
foreach (GXDLMSWeekProfile it in target)
{
data.SetUInt8((byte)DataType.Structure);
Is this something that has been fixed in a later version of Gurux? Or is it maybe the meter that handles this wrong?
I also got the same error "Device reports unmatched type" when I tried to set SpecialDays table. But when I added DataType.Array as last argument to client.Method in Insert (GXDLMSSpecialDaysTable) it started working ok.
Is this a bug in Gurux, or am I doing something else wrong?
Sorry, in GetWeekProfileTable there should be one array that includes structures. I checked the source code and it seems to be correct. What array did you change to Structure? If it was this, there is an issue on the meter.
static byte[] GetWeekProfileTable(GXDLMSSettings settings, GXDLMSWeekProfile[] target)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((byte)DataType.Array);
I have updated to the latest version and I can see that it´s Structure, so that should be ok now.
What about GXDLMSSpecialDaysTable? I get the same error "Device reports unmatched type" when I try to set SpecialDays table. But when I added DataType.Array as last argument to client.Method in Insert (GXDLMSSpecialDaysTable) it started working ok.
I still can´t get the communication to work without Encryption. Could you maybe be more specific in what I need to change? This is how I try to create the client with Ciphering.Security set to Security.Authentication. But this will end up with the following error: "Authentication is required"
Hi
HighGMAC is supported, that´s the common way that we communicate with the meters. But when I want to look at the DLMS packets with Wireshark I need to run without encryption. The question is, how can this be done?
Regards
Helena
Hi again
Hi again
The reason why we want to run without encryption is because we need to see in Wireshark what we send when we try to set WeekProfile in the passive calendar in the meter. When we try this, we get the error "Device reports unmatched type". And when we set Week profile with Kaifas tool SmartSet we get no error. Maybe you have an idea why we get "Device reports unmatched type"?
Regards
Helena
Hi
Hi
I think I´ve found the problem why I can´t set Week profile in the meter. It was because the wrong DataType (Array) was set in GetWeekProfileTable(), When I changed to Structure it went ok.
static byte[] GetWeekProfileTable(GXDLMSSettings settings, GXDLMSWeekProfile[] target)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((byte)DataType.Array);
if (target == null)
{
//Add count
GXCommon.SetObjectCount(0, data);
}
else
{
int cnt = target.Length;
//Add count
GXCommon.SetObjectCount(cnt, data);
foreach (GXDLMSWeekProfile it in target)
{
data.SetUInt8((byte)DataType.Structure);
Is this something that has been fixed in a later version of Gurux? Or is it maybe the meter that handles this wrong?
Regards
Helena
Hello
Hello
I also got the same error "Device reports unmatched type" when I tried to set SpecialDays table. But when I added DataType.Array as last argument to client.Method in Insert (GXDLMSSpecialDaysTable) it started working ok.
Is this a bug in Gurux, or am I doing something else wrong?
Regards
Helena
Authentication required when running without Encryption
Hi,
You have secure the connection, but not use authentication (authentication is None). Set authentication and password and this will work.
BR,
Mikko
Activity Calendar
Hi,
Sorry, in GetWeekProfileTable there should be one array that includes structures. I checked the source code and it seems to be correct. What array did you change to Structure? If it was this, there is an issue on the meter.
static byte[] GetWeekProfileTable(GXDLMSSettings settings, GXDLMSWeekProfile[] target)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((byte)DataType.Array);
BR,
Mikko
Hi
Hi
No, I didn´t change that one. I changed this one from Array to Structure:
foreach (GXDLMSWeekProfile it in target)
{
data.SetUInt8((byte)DataType.Structure);
Regards
Helena
Activity Calendar
Hi,
Check that you have the latest version. I just checked the source code and its Structure.
BR,
Mikko
Hi
Hi
I have updated to the latest version and I can see that it´s Structure, so that should be ok now.
What about GXDLMSSpecialDaysTable? I get the same error "Device reports unmatched type" when I try to set SpecialDays table. But when I added DataType.Array as last argument to client.Method in Insert (GXDLMSSpecialDaysTable) it started working ok.
public byte[][] Insert(GXDLMSClient client, GXDLMSSpecialDay entry)
{
GXByteBuffer bb = new GXByteBuffer();
bb.SetUInt8(DataType.Structure);
bb.SetUInt8(3);
GXCommon.SetData(null, bb, DataType.UInt16, entry.Index);
GXCommon.SetData(null, bb, DataType.OctetString, entry.Date);
GXCommon.SetData(null, bb, DataType.UInt8, entry.DayId);
return client.Method(this, 1, bb.Array(),DataType.Array);
}
Regards
Helena
GXDLMSSpecialDaysTable
Hi,
You are right. This should be an array of GXDLMSSpecialDays. We'll fix this. The new version is released today.
BR,
Miko
GXDLMSSpecialDaysTable
Hi,
This is fixed, tested and released. Get the latest version.
BR,
Mikko
Hi
Hi
Thank you for the new release.
I still can´t get the communication to work without Encryption. Could you maybe be more specific in what I need to change? This is how I try to create the client with Ciphering.Security set to Security.Authentication. But this will end up with the following error: "Authentication is required"
gxdlmsClient = new GXDLMSSecureClient(true, 0x01, 0x01, Authentication.HighGMAC,
authenticationSettings.UniqueSecret, InterfaceType.WRAPPER)
{
ProposedConformance = Conformance.Action |
Conformance.EventNotification |
Conformance.SelectiveAccess | Conformance.Set |
Conformance.Get | Conformance.InformationReport |
Conformance.MultipleReferences |
Conformance.BlockTransferWithAction |
Conformance.BlockTransferWithSetOrWrite |
Conformance.BlockTransferWithGetOrRead,
MaxReceivePDUSize = 0x00C8,
Password = authenticationSettings.UniqueSecret.ToByteArray(),
CtoSChallenge = GXDLMSTranslator.HexToBytes("D7C3FAF279A8D3A3EFF1CE601E8A663F")
};
if (authenticationSettings.InvocationCounter > 0)
{
((GXDLMSSecureClient)gxdlmsClient).Ciphering.InvocationCounter = authenticationSettings.InvocationCounter;
}
((GXDLMSSecureClient) gxdlmsClient).Ciphering.SystemTitle = authenticationSettings.SystemTitle.ToByteArray();
((GXDLMSSecureClient) gxdlmsClient).Ciphering.Security = Security.Authentication;
((GXDLMSSecureClient)gxdlmsClient).Ciphering.AuthenticationKey = authenticationSettings.AuthenticationKey.ToByteArray();
((GXDLMSSecureClient)gxdlmsClient).Ciphering.BlockCipherKey = authenticationSettings.UnicastKey.ToByteArray();
Regards
Helena
Encryption
Hi,
Your settings seem to be right. Can you ask the vendor is HighGMAC authentication supported or should you use some other authentication level?
BR,
Mikko
Hi
Hi
HighGMAC is supported, that´s the common way that we communicate with the meters. But when I want to look at the DLMS packets with Wireshark I need to run without encryption. The question is, how can this be done?
Regards
Helena
Authentication vs. Ciphering
Hi,
You can remove encryption if you set this:
client.Ciphering.Security = Security.None;
Authentication is used to tell what kind of access rights you have to the meter.
client.Authentication = Authentication.HighGMAC
Ciphering is used encrypt sent and received messages.
BR,
Mikko