forked from DNAProject/DNA-java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataFileTransaction.java
More file actions
38 lines (31 loc) · 1.14 KB
/
Copy pathDataFileTransaction.java
File metadata and controls
38 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package DNA.Core;
import java.io.IOException;
import java.math.BigInteger;
import org.bouncycastle.math.ec.ECPoint;
import DNA.Helper;
import DNA.Cryptography.ECC;
import DNA.IO.BinaryReader;
import DNA.IO.BinaryWriter;
public class DataFileTransaction extends Transaction {
public String ipfsPath;
public String fileName;
public String note;
public ECPoint issuer;
protected DataFileTransaction() {
super(TransactionType.DataFile);
}
protected void deserializeExclusiveData(BinaryReader reader) throws IOException {
ipfsPath = reader.readVarString();
fileName = reader.readVarString();
note = reader.readVarString();
issuer = ECC.secp256r1.getCurve().createPoint(
new BigInteger(1,reader.readVarBytes()), new BigInteger(1,reader.readVarBytes()));
}
protected void serializeExclusiveData(BinaryWriter writer) throws IOException {
writer.writeVarString(ipfsPath);
writer.writeVarString(fileName);
writer.writeVarString(note);
writer.writeVarBytes(Helper.removePrevZero(issuer.getXCoord().toBigInteger().toByteArray()));
writer.writeVarBytes(Helper.removePrevZero(issuer.getYCoord().toBigInteger().toByteArray()));
}
}