Source:
<code>private ClientConnection createConnection() throws IOException, TechnicalException { final SecurityKey validAuthenticationKey = this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION); final SecurityKey validEncryptionKey = this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION); try { final String authenticationKeyValue = validAuthenticationKey.getKey(); final String encryptionKeyValue = validEncryptionKey.getKey(); final byte[] authenticationKey = org.apache.commons.codec.binary.Hex.decodeHex(authenticationKeyValue <START> .toCharArray()); <END> final byte[] encryptionKey = org.apache.commons.codec.binary.Hex .decodeHex(encryptionKeyValue.toCharArray()); final byte[] decryptedAuthentication = RSAEncrypterService.decrypt(authenticationKey, this.devicePrivateKeyPath); final byte[] decryptedEncryption = RSAEncrypterService.decrypt(encryptionKey, this.devicePrivateKeyPath); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder( InetAddress.getByName(this.device.getIpAddress())) .useGmacAuthentication(decryptedAuthentication, decryptedEncryption) .enableEncryption(decryptedEncryption).responseTimeout(this.responseTimeout) .logicalDeviceAddress(this.logicalDeviceAddress).clientAccessPoint(this.clientAccessPoint); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.challengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); } catch (final DecoderException e) { LOGGER.error("Unexpected exception while readinig RSA key", e); throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "Error while reading RSA key! "); } }</code><technical_language>commit history I find explanation hex decoding changed org.bouncycastle.util.encoders.Hex org.apache.commons.codec.binary.Hex. If a good reason, I curious was, otherwise, careful replace working code other variants frivolously. a matter of style, I is code short clean adding proper import statements instead of fully qualified class names in code</technical_language>

Target:
private ClientConnection createConnection() throws IOException, TechnicalException, RsaEncrypterException { final SecurityKey validAuthenticationKey = this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION); final SecurityKey validEncryptionKey = this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION); final byte[] authenticationKey = Hex.decode(validAuthenticationKey.getKey()); final byte[] encryptionKey = Hex.decode(validEncryptionKey.getKey()); final byte[] decryptedAuthentication = RsaEncrypterService .decrypt(authenticationKey, this.devicePrivateKeyPath); final byte[] decryptedEncryption = RsaEncrypterService.decrypt(encryptionKey, this.devicePrivateKeyPath); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device .getIpAddress())).useGmacAuthentication(decryptedAuthentication, decryptedEncryption) .enableEncryption(decryptedEncryption).responseTimeout(this.responseTimeout) .logicalDeviceAddress(this.logicalDeviceAddress).clientAccessPoint(this.clientAccessPoint); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.challengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }