Thanks Mikko. But GXDLMSNotify class doesn't implement security, system title, block cipher key and authentication key.
Do we need to implement GXDLMSClient to send notifications.
We use GXDLMSSecureNotify class but still messages are not encrypted.
media = new GXNet(NetworkType.TCP, getHostName(), getPort(),false,ipv4,getRemoteHostName(),getRemotePort());
//GXDLMSNotify cl = new GXDLMSNotify(true, 64, 1, InterfaceType.WRAPPER);
GXDLMSSecureNotify cl = new GXDLMSSecureNotify(true, 64, 1, InterfaceType.WRAPPER);
GXDLMSPushSetup p = new GXDLMSPushSetup();
GXDLMSClock clock = new GXDLMSClock();
clock.setTime(new GXDateTime(Calendar.getInstance().getTime()));
p.getPushObjectList()
.add(new GXSimpleEntry<GXDLMSObject, GXDLMSCaptureObject>(p,
new GXDLMSCaptureObject(2, 0)));
p.getPushObjectList()
.add(new GXSimpleEntry<GXDLMSObject, GXDLMSCaptureObject>(clock,
new GXDLMSCaptureObject(2, 0)));
media.open();
for (byte[] it : cl.generatePushSetupMessages(null, p)) {
public GXDLMSSecureNotify(final boolean useLogicalNameReferencing,
final int clientAddress, final int serverAddress,
final InterfaceType interfaceType) {
super(useLogicalNameReferencing, clientAddress, serverAddress,
interfaceType);
ciphering = new GXCiphering("ABCDEFGH".getBytes());
setCipher(ciphering);
}
public GXCiphering(final byte[] title) {
publicKeys = new ArrayList<Map.Entry<CertificateType, PublicKey>>();
certificates = new ArrayList<GXx509Certificate>();
setSecurity(Security.NONE);
setSystemTitle(title);
setBlockCipherKey("eeslekakgsl06abc".getBytes());
setAuthenticationKey("eeslekakgsl06abc".getBytes());
Same GXCiphering is used for GXDLMSServerLN_47 which is working fine.
Hi Utkarsh,
Hi Utkarsh,
You need to set security, system title, block cipher key and authentication key if you want to encrypt (cipher) the data.
BR,
Mikko
Thanks Mikko. But
Thanks Mikko. But GXDLMSNotify class doesn't implement security, system title, block cipher key and authentication key.
Do we need to implement GXDLMSClient to send notifications.
Regards,
Utkarsh
Hi,
Hi,
You need to use GXDLMSSecureNotify. GXDLMSClient doesn't send notifications, it can receive them.
BR,
Mikko
Hi Mikko,
Hi Mikko,
We use GXDLMSSecureNotify class but still messages are not encrypted.
media = new GXNet(NetworkType.TCP, getHostName(), getPort(),false,ipv4,getRemoteHostName(),getRemotePort());
//GXDLMSNotify cl = new GXDLMSNotify(true, 64, 1, InterfaceType.WRAPPER);
GXDLMSSecureNotify cl = new GXDLMSSecureNotify(true, 64, 1, InterfaceType.WRAPPER);
GXDLMSPushSetup p = new GXDLMSPushSetup();
GXDLMSClock clock = new GXDLMSClock();
clock.setTime(new GXDateTime(Calendar.getInstance().getTime()));
p.getPushObjectList()
.add(new GXSimpleEntry<GXDLMSObject, GXDLMSCaptureObject>(p,
new GXDLMSCaptureObject(2, 0)));
p.getPushObjectList()
.add(new GXSimpleEntry<GXDLMSObject, GXDLMSCaptureObject>(clock,
new GXDLMSCaptureObject(2, 0)));
media.open();
for (byte[] it : cl.generatePushSetupMessages(null, p)) {
public GXDLMSSecureNotify(final boolean useLogicalNameReferencing,
final int clientAddress, final int serverAddress,
final InterfaceType interfaceType) {
super(useLogicalNameReferencing, clientAddress, serverAddress,
interfaceType);
ciphering = new GXCiphering("ABCDEFGH".getBytes());
setCipher(ciphering);
}
public GXCiphering(final byte[] title) {
publicKeys = new ArrayList<Map.Entry<CertificateType, PublicKey>>();
certificates = new ArrayList<GXx509Certificate>();
setSecurity(Security.NONE);
setSystemTitle(title);
setBlockCipherKey("eeslekakgsl06abc".getBytes());
setAuthenticationKey("eeslekakgsl06abc".getBytes());
Same GXCiphering is used for GXDLMSServerLN_47 which is working fine.
Message:
00 3C 0F C0 00 00 01 00 02 02 01 02 02 04 12 00 28 09 06 00 04 19 09 00 FF 0F 02 12 00 00 02 04 12 00 08 09 06 00 00 01 00 00 FF 0F 02 12 00 00 09 0C 07 E4 01 16 03 0A 0E 05 15 01 E0 00
Regards,
Utkarsh
Hi Utkarsh,
Hi Utkarsh,
In GXCiphering-method you are setting security to NONE.
Try like this:
GXDLMSSecureNotify cl = new GXDLMSSecureNotify(true, 1, 1, InterfaceType.WRAPPER);
cl.getCiphering().setSecurity(Security.AUTHENTICATION_ENCRYPTION);
BR,
Mikko
Thanks Mikko. It worked.
Thanks Mikko. It worked.
Hi Mikko,
Created as new question.
Hi Max,
Hi Max,
Please, create a new topic if you have a new question. I'll answer for your question there.
BR,
Mikko