Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Riscure Inspector uses the `.trs` file format to save and read traces from disk.
This library supports reading and writing of `.trs` files, but it does not support modifying existing `.trs` files.

### Installation
TODO
Simply include the latest release of the library jar in your project. It is currently not available through any distribution networks (Maven central, etc..). If this changes, it will be stated here.

### General use tips
##### File creation
Expand Down
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.riscure</groupId>
<artifactId>trsfile</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -16,6 +16,19 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
Expand All @@ -34,6 +47,11 @@

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
Expand Down
36 changes: 12 additions & 24 deletions src/main/java/com/riscure/trs/Trace.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void forceFloatCoding() {
/**
* Get the preferred data type to store samples
*
* @return data type
* @return the preferred data type to store samples
**/
public int getPreferredCoding() {
if (!aggregatesValid)
Expand Down Expand Up @@ -154,8 +154,7 @@ public String getTitle() {
/**
* Set the title for this trace.
*
* @param title
* the new title
* @param title the new title
*/
public void setTitle(String title) {
this.title = title;
Expand All @@ -173,15 +172,16 @@ public float getSampleFrequency() {
/**
* Set the sample frequency for this trace.
*
* @param sampleFrequency
* the sample frequency
* @param sampleFrequency the sample frequency
*/
public void setSampleFrequency(float sampleFrequency) {
this.sampleFrequency = sampleFrequency;
}

/**
* Get the supplementary (crypto) data of this trace.
*
* @return the supplementary data of this trace
*/
public byte[] getData() {
return data;
Expand All @@ -198,13 +198,17 @@ public void setData(byte[] data) {

/**
* Get the supplementary (crypto) data of this trace as a hexadecimal string.
*
* @return the supplementary (crypto) data of this trace as a hexadecimal string
*/
public String getDataString() {
return new BigInteger(data).toString(16);
}

/**
* Get the number of samples that this trace is shifted.
*
* @return the number of samples that this trace is shifted
*/
public int getShifted() {
return shifted;
Expand All @@ -213,37 +217,21 @@ public int getShifted() {
/**
* Set the number of samples that this trace is shifted
*
* @param shifted
* number of shifted samples
* @param shifted number of shifted samples
*/
public void setShifted(int shifted) {
this.shifted = shifted;
}

/**
* Get the length of the sample array.
*
* @return the length of the sample array
*/
public int getNumberOfSamples() {
return sample.limit();
}

/**
* Get the TraceSet containing this Trace.
*/
public TraceSet getTraceSet() {
return ts;
}

/**
* set the TraceSet for this Trace
*
* @param ts
* the new TraceSet
*/
public void setTraceSet(TraceSet ts) {
this.ts = ts;
}

private FloatBuffer sample;
/** trace title */
public String title = null;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/riscure/trs/TraceSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ public static TraceSet open(String file) throws IOException, TRSFormatException
* @param file the path to the file to save
* @param traces the list of traces to save in the file
* @throws IOException when any write exception is encountered
* @throws TRSFormatException when any TRS formatting issues arise from saving the provided traces
*/
public static void save(String file, List<Trace> traces) throws IOException, TRSFormatException {
TRSMetaData trsMetaData = TRSMetaData.create();
Expand All @@ -372,6 +373,7 @@ public static void save(String file, List<Trace> traces) throws IOException, TRS
* @param traces the list of traces to save in the file
* @param metaData the metadata associated with the set to create
* @throws IOException when any write exception is encountered
* @throws TRSFormatException when any TRS formatting issues arise from saving the provided traces
*/
public static void save(String file, List<Trace> traces, TRSMetaData metaData) throws IOException, TRSFormatException {
TraceSet traceSet = create(file, metaData);
Expand Down Expand Up @@ -410,6 +412,7 @@ public static TraceSet create(String file) throws IOException {
* SCALE_X is defined for the whole set based on the sampling frequency of the first trace <br>
* SAMPLE_CODING is defined for the whole set based on the values of the first trace <br>
* @param file the path to the file to be created
* @param metaData the user-supplied meta data
* @return a writable trace set object
* @throws IOException if the file creation failed
*/
Expand Down