Loading javasrc/adapter/org/etsi/its/adapter/ports/GnPort.java +13 −11 Original line number Diff line number Diff line Loading @@ -123,12 +123,8 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific basicHeader[0] &= 0xFE; basicHeader[0] |= 0x02; // Secured mode // Update the beacon timestamp field byte[] beacon = ByteHelper.concat( ByteHelper.extract(p_beacon, 4, 16), // Extract Common Header + GN address p_tst, // Update the timestamp field ByteHelper.extract(p_beacon, 20, p_beacon.length - 4 - 20) // Add remaining bytes ); // Basic Header is not part of signed data byte[] beacon = ByteHelper.extract(p_beacon, 4, p_beacon.length - 4); //TERFactory.getInstance().logDebug("GnPort.buildSecuredBeacon (2): " + ByteHelper.byteArrayToString(beacon)); // Prepare the message to be signed byte[] toBeSignedData = buildToBeSignedData(beacon, p_currentTime, p_sendDigest); Loading Loading @@ -225,7 +221,7 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific byte[] signatureBytes; try { signatureBytes = CryptoLib.signWithEcdsaNistp256WithSha256(p_toBeSignedData, management.getSigningPrivateKey()); // //TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: signatureBytes=" + ByteHelper.byteArrayToString(signatureBytes)); //TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: signatureBytes=" + ByteHelper.byteArrayToString(signatureBytes)); // Add signature securedBeaconHeader = ByteHelper.concat( p_toBeSignedData, Loading Loading @@ -298,17 +294,23 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific if(headerType != HT_BEACON && !(headerType == HT_TSB && headerSubType == HST_SHB) ) { sopvPos += 4; } try { System.arraycopy(message, sopvPos, sopv, 0, 24); } catch (IndexOutOfBoundsException e) { // Decoding issue return; } //TERFactory.getInstance().logDebug("GnPort.receive: sopv=" + ByteHelper.byteArrayToString(sopv)); // Security disable, null will be translated into omit lowerInfo.put(SecurityHelper.SEC_SSP, null); lowerInfo.put(SecurityHelper.SEC_ITS_AID, null); } else if ((basicHdr[0] & 0x0f) == 0x02) { // Secured tag byte[] payload = SecurityHelper.getInstance().checkSecuredProfileAndExtractPayload(message, basicHdr.length, management.isEnforceSecuredModeSet(), management.getItsAidOther(), lowerInfo); if (payload != null) { // //TERFactory.getInstance().logDebug("GnPort.receive: payload=" + ByteHelper.byteArrayToString(payload)); //TERFactory.getInstance().logDebug("GnPort.receive: payload=" + ByteHelper.byteArrayToString(payload)); byte[] commonHdr = new byte[8]; System.arraycopy(payload, 0, commonHdr, 0, 8); // //TERFactory.getInstance().logDebug("GnPort.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr)); //TERFactory.getInstance().logDebug("GnPort.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr)); byte[] htHst = new byte[1]; System.arraycopy(commonHdr, 1, htHst, 0, 1); headerType = (int)(htHst[0] >> 4); Loading Loading
javasrc/adapter/org/etsi/its/adapter/ports/GnPort.java +13 −11 Original line number Diff line number Diff line Loading @@ -123,12 +123,8 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific basicHeader[0] &= 0xFE; basicHeader[0] |= 0x02; // Secured mode // Update the beacon timestamp field byte[] beacon = ByteHelper.concat( ByteHelper.extract(p_beacon, 4, 16), // Extract Common Header + GN address p_tst, // Update the timestamp field ByteHelper.extract(p_beacon, 20, p_beacon.length - 4 - 20) // Add remaining bytes ); // Basic Header is not part of signed data byte[] beacon = ByteHelper.extract(p_beacon, 4, p_beacon.length - 4); //TERFactory.getInstance().logDebug("GnPort.buildSecuredBeacon (2): " + ByteHelper.byteArrayToString(beacon)); // Prepare the message to be signed byte[] toBeSignedData = buildToBeSignedData(beacon, p_currentTime, p_sendDigest); Loading Loading @@ -225,7 +221,7 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific byte[] signatureBytes; try { signatureBytes = CryptoLib.signWithEcdsaNistp256WithSha256(p_toBeSignedData, management.getSigningPrivateKey()); // //TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: signatureBytes=" + ByteHelper.byteArrayToString(signatureBytes)); //TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: signatureBytes=" + ByteHelper.byteArrayToString(signatureBytes)); // Add signature securedBeaconHeader = ByteHelper.concat( p_toBeSignedData, Loading Loading @@ -298,17 +294,23 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific if(headerType != HT_BEACON && !(headerType == HT_TSB && headerSubType == HST_SHB) ) { sopvPos += 4; } try { System.arraycopy(message, sopvPos, sopv, 0, 24); } catch (IndexOutOfBoundsException e) { // Decoding issue return; } //TERFactory.getInstance().logDebug("GnPort.receive: sopv=" + ByteHelper.byteArrayToString(sopv)); // Security disable, null will be translated into omit lowerInfo.put(SecurityHelper.SEC_SSP, null); lowerInfo.put(SecurityHelper.SEC_ITS_AID, null); } else if ((basicHdr[0] & 0x0f) == 0x02) { // Secured tag byte[] payload = SecurityHelper.getInstance().checkSecuredProfileAndExtractPayload(message, basicHdr.length, management.isEnforceSecuredModeSet(), management.getItsAidOther(), lowerInfo); if (payload != null) { // //TERFactory.getInstance().logDebug("GnPort.receive: payload=" + ByteHelper.byteArrayToString(payload)); //TERFactory.getInstance().logDebug("GnPort.receive: payload=" + ByteHelper.byteArrayToString(payload)); byte[] commonHdr = new byte[8]; System.arraycopy(payload, 0, commonHdr, 0, 8); // //TERFactory.getInstance().logDebug("GnPort.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr)); //TERFactory.getInstance().logDebug("GnPort.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr)); byte[] htHst = new byte[1]; System.arraycopy(commonHdr, 1, htHst, 0, 1); headerType = (int)(htHst[0] >> 4); Loading