Skip to content

Commit

Permalink
* ODE-689: .h files from Lear needs to be updated
Browse files Browse the repository at this point in the history
* ODE-690: Incorrect BSM transmit validation signature
* ODE-685: Adding fields for host and remote vehicles for BSMs
  • Loading branch information
hmusavi committed Jan 24, 2018
1 parent f97fde5 commit 0c7164c
Show file tree
Hide file tree
Showing 21 changed files with 485 additions and 356 deletions.
2 changes: 1 addition & 1 deletion data/wydotLogRecords_Tony.h → data/wydotLogRecords.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/* securityResultCode contains below result codes */
typedef enum _securityResultCode { /* from dot3 */
success = 1,
success = 0,
inconsistentInputParameters = 2,
spduParsingInvalidInput = 3,
spduParsingUnsupportedCriticalInformationField = 4,
Expand Down
Binary file modified docs/JPO_ODE_UserGuide.docx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,61 @@
import java.util.Date;

public class DateTimeUtils {

private DateTimeUtils() {}

private DateTimeUtils() {
}

public static String now() {
return ZonedDateTime.now(ZoneId.of("UTC")).format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
return nowZDT().format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
}


public static ZonedDateTime nowZDT() {
return ZonedDateTime.now(ZoneId.of("UTC"));
}

public static String isoDateTime(ZonedDateTime zonedDateTime) {
return zonedDateTime.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
}

public static ZonedDateTime isoDateTime(int year, int month, int dayOfMonth,
int hourOfDay, int minute, int second, int millisec) {
return ZonedDateTime.of(year, month, dayOfMonth,
hourOfDay, minute, second, millisec * 1000000,
ZoneOffset.UTC);

public static ZonedDateTime
isoDateTime(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second, int millisec) {
return ZonedDateTime.of(year, month, dayOfMonth, hourOfDay, minute, second, millisec * 1000000, ZoneOffset.UTC);
}

public static ZonedDateTime isoDateTime(String s) throws ParseException {
return ZonedDateTime.parse(s);
}

public static ZonedDateTime isoDateTime(Date date) {
return ZonedDateTime.from(date.toInstant().atZone(ZoneId.of("UTC")));
}
return ZonedDateTime.from(date.toInstant().atZone(ZoneId.of("UTC")));
}

public static ZonedDateTime isoDateTime(long epockMillis) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(epockMillis), ZoneId.of("UTC"));
}

public static boolean isBetweenTimesInclusive(
ZonedDateTime dateTime,
ZonedDateTime startDateTime,
ZonedDateTime endDateTime) {

public static boolean
isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime) {

if (dateTime == null)
return true;

if (startDateTime == null) {
if (endDateTime == null) {// Both startDate and endDate are null, so it's false
if (endDateTime == null) {// Both startDate and endDate are null, so
// it's false
return true;
} else {// We only have the endDate, so any dateTime not after the endDateTime is true
} else {// We only have the endDate, so any dateTime not after the
// endDateTime is true
return !dateTime.isAfter(endDateTime);
}
} else {
if (endDateTime == null) {// We only have the startDateTime, so any dateTime not before the startDateTime is true
if (endDateTime == null) {// We only have the startDateTime, so any
// dateTime not before the startDateTime is
// true
return !dateTime.isBefore(startDateTime);
} else {// We have both startDateTime and endDateTime, so any dateTime not before the startDate and not after endDateTime is true
return !dateTime.isBefore(startDateTime) &&
!dateTime.isAfter(endDateTime);
} else {// We have both startDateTime and endDateTime, so any dateTime
// not before the startDate and not after endDateTime is true
return !dateTime.isBefore(startDateTime) && !dateTime.isAfter(endDateTime);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package us.dot.its.jpo.ode.model;

import com.fasterxml.jackson.databind.JsonNode;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class OdeAsn1Metadata extends OdeLogMetadata {
Expand All @@ -30,30 +27,6 @@ public OdeAsn1Metadata(OdeMsgPayload payload) {
super(payload);
}

public OdeAsn1Metadata(JsonNode metadata) {
setEncodings(metadata.get("encodings").get("encodings"));
setRecordGeneratedAt(metadata.get("generatedAt").asText());
setRecordGeneratedBy(GeneratedBy.valueOf(metadata.get("generatedBy").asText()));
setLogFileName(metadata.get("logFileName").asText());
setRecordType(metadata.get("recordType").asText());
setPayloadType(metadata.get("payloadType").asText());
setOdeReceivedAt(metadata.get("odReceivedAt").asText());
setSanitized(metadata.get("sanitized").asBoolean());
setSchemaVersion(metadata.get("schemaVersion").asInt());
setSerialId(new SerialId(metadata.get("serialId")));
setValidSignature(metadata.get("validSignature").asBoolean());
}

private void setEncodings(JsonNode encodings) {
if (encodings.isArray()) {
Iterator<JsonNode> elements = encodings.elements();

while (elements.hasNext()) {
this.encodings.add(new Asn1Encoding(elements.next()));
}
}
}

public List<Asn1Encoding> getEncodings() {
return encodings;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package us.dot.its.jpo.ode.model;

import us.dot.its.jpo.ode.model.OdeBsmMetadata.BsmSource;

public class OdeAsn1WithBsmMetadata extends OdeAsn1Metadata {

private static final long serialVersionUID = 299691716113824640L;

private BsmSource bsmSource;

public OdeAsn1WithBsmMetadata() {
super();
}

public OdeAsn1WithBsmMetadata(OdeMsgPayload payload) {
super(payload);
}

public BsmSource getBsmSource() {
return bsmSource;
}

public void setBsmSource(BsmSource bsmSource) {
this.bsmSource = bsmSource;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@ public class OdeBsmMetadata extends OdeLogMetadata {

private static final long serialVersionUID = -8601265839394150140L;

public enum BsmSource {
EV, RV, unknown
}

private BsmSource bsmSource;

public OdeBsmMetadata() {
super();
}

public OdeBsmMetadata(OdeMsgPayload payload) {
public OdeBsmMetadata(OdeMsgPayload payload) {
super(payload);
}

public OdeBsmMetadata(OdeMsgPayload payload, SerialId serialId, String receivedAt) {

}

public BsmSource getBsmSource() {
return bsmSource;
}

public void setBsmSource(BsmSource bsmSource) {
this.bsmSource = bsmSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,90 @@

public class OdeLogMetadata extends OdeMsgMetadata {

private static final long serialVersionUID = -8601265839394150140L;
private static final long serialVersionUID = -8601265839394150140L;

private String logFileName;
private String recordType;
public enum RecordType {
bsmLogDuringEvent, rxMsg, dnMsg, bsmTx, driverAlert, unsupported
}

public OdeLogMetadata(OdeMsgPayload payload) {
super(payload);
}
public enum SecurityResultCode {
success,
unknown,
inconsistentInputParameters,
spduParsingInvalidInput,
spduParsingUnsupportedCriticalInformationField,
spduParsingCertificateNotFound,
spduParsingGenerationTimeNotAvailable,
spduParsingGenerationLocationNotAvailable,
spduCertificateChainNotEnoughInformationToConstructChain,
spduCertificateChainChainEndedAtUntrustedRoot,
spduCertificateChainChainWasTooLongForImplementation,
spduCertificateChainCertificateRevoked,
spduCertificateChainOverdueCRL,
spduCertificateChainInconsistentExpiryTimes,
spduCertificateChainInconsistentStartTimes,
spduCertificateChainInconsistentChainPermissions,
spduCryptoVerificationFailure,
spduConsistencyFutureCertificateAtGenerationTime,
spduConsistencyExpiredCertificateAtGenerationTime,
spduConsistencyExpiryDateTooEarly,
spduConsistencyExpiryDateTooLate,
spduConsistencyGenerationLocationOutsideValidityRegion,
spduConsistencyNoGenerationLocation,
spduConsistencyUnauthorizedPSID,
spduInternalConsistencyExpiryTimeBeforeGenerationTime,
spduInternalConsistencyextDataHashDoesntMatch,
spduInternalConsistencynoExtDataHashProvided,
spduInternalConsistencynoExtDataHashPresent,
spduLocalConsistencyPSIDsDontMatch,
spduLocalConsistencyChainWasTooLongForSDEE,
spduRelevanceGenerationTimeTooFarInPast,
spduRelevanceGenerationTimeTooFarInFuture,
spduRelevanceExpiryTimeInPast,
spduRelevanceGenerationLocationTooDistant,
spduRelevanceReplayedSpdu,
spduCertificateExpired
}

public OdeLogMetadata() {
super();
}

public OdeLogMetadata(String payloadType, SerialId serialId, String receivedAt) {
super(payloadType, serialId, receivedAt);
}
private String logFileName;
private RecordType recordType;
private SecurityResultCode securityResultCode;

public OdeLogMetadata(OdeMsgPayload payload) {
super(payload);
}

public String getLogFileName() {
return logFileName;
}
public OdeLogMetadata() {
super();
}

public void setLogFileName(String logFileName) {
this.logFileName = logFileName;
}
public OdeLogMetadata(String payloadType, SerialId serialId, String receivedAt) {
super(payloadType, serialId, receivedAt);
}

public String getRecordType() {
return recordType;
}
public String getLogFileName() {
return logFileName;
}

public void setRecordType(String recordType) {
this.recordType = recordType;
}
public void setLogFileName(String logFileName) {
this.logFileName = logFileName;
}

public RecordType getRecordType() {
return recordType;
}

public void setRecordType(RecordType recordType) {
this.recordType = recordType;
}

public SecurityResultCode getSecurityResultCode() {
return securityResultCode;
}

public void setSecurityResultCode(SecurityResultCode securityResultCode) {
this.securityResultCode = securityResultCode;
}

}
Loading

0 comments on commit 0c7164c

Please sign in to comment.