Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for KNX IP Secure : Getting Unauthenticated #140

Open
bhanujarya opened this issue Nov 26, 2024 · 0 comments
Open

Support for KNX IP Secure : Getting Unauthenticated #140

bhanujarya opened this issue Nov 26, 2024 · 0 comments

Comments

@bhanujarya
Copy link

Hi , i am trying to control knx ip secure device by establishing secure link , my code is

	public static void main(String[] args) {
		final var duration = Duration.ofSeconds(60);
		System.out.println("This example establishes a secure tunneling link to "
				+ server + ", and waits for tunneled datagrams for "
				+ duration.toSeconds() + " seconds");

		final byte[] userKey = SecureConnection.hashUserPassword(userPwd.toCharArray());
		final byte[] deviceAuthCode = SecureConnection.hashDeviceAuthenticationPassword(deviceAuthPwd.toCharArray());
		
		var tcpTry = TcpConnection.newTcpConnection(server);
		System.out.println("tcp try is " + tcpTry);
		
		var sessionTry = tcpTry.newSecureSession(user, userKey, deviceAuthCode);
		System.out.println("sessionTry " + sessionTry);

//		IndividualAddress dev = new IndividualAddress(1/1/1);
		try (	var tcp = TcpConnection.newTcpConnection(server);
				var session = tcp.newSecureSession(user, userKey, deviceAuthCode);
				var link = KNXNetworkLinkIP.newSecureTunnelingLink(session, new TPSettings())) {

			System.out.println("inside try block ");
			link.addLinkListener(new NetworkLinkListener() {
				@Override
				public void indication(final FrameEvent e) { System.out.println(e.getFrame()); }
			});

			
			
			System.out.println("Secure link established to " + link.getName());
			Thread.sleep(duration.toMillis());
		}
		catch (KNXException | InterruptedException e) {
			System.out.println("Error creating KNX IP secure tunneling link: " + e);
			e.printStackTrace();
		}
		finally {
			System.out.println("Link closed");
		}
	}

We have given correct passwords but we getting unauthenticated

This example establishes a secure tunneling link to /192.168.100.100:3671, and waits for tunneled datagrams for 60 seconds
tcp try is 0.0.0.0:0<=>192.168.100.100:3671 (unbound)
sessionTry 🔒 session 0 (user 2): Idle
Nov 26, 2024 3:23:37 PM io.calimero.knxnetip.StreamConnection$SecureSession parseSessionResponse
WARNING: skipping device authentication of 192.168.100.100:3671 (no device key)
Nov 26, 2024 3:23:37 PM io.calimero.knxnetip.StreamConnection$SecureSession acceptServiceType
SEVERE: authorization failed 🔒 session 7 (user 2): Unauthenticated
Link closed
Exception in thread "main" io.calimero.secure.KnxSecureException: secure session authorization failed
	at io.calimero.knxnetip.StreamConnection$SecureSession.setupSecureSession(StreamConnection.java:300)
	at io.calimero.knxnetip.StreamConnection$SecureSession.ensureOpen(StreamConnection.java:248)
	at io.calimero.knxnetip.SecureConnection.newTunneling(SecureConnection.java:125)
	at io.calimero.link.KNXNetworkLinkIP.newSecureTunnelingLink(KNXNetworkLinkIP.java:202)
	at knxtest.KNXSecurePassword.main(KNXSecurePassword.java:58)

Can you please help in resolving steps for this issue
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant