aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java
diff options
context:
space:
mode:
authorMoxie Marlinspike <moxie@thoughtcrime.org>2015-01-08 13:48:49 -0800
committerMoxie Marlinspike <moxie@thoughtcrime.org>2015-01-08 14:09:01 -0800
commit6445ea5f13850f42c3952bd06a2369317683ed88 (patch)
treef2bb37c8cf4710ff6a6a37a3e7e702c5a21ca504 /src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java
parenta4d8f7f6a4c4e9e89db35f299e558dceee2362a1 (diff)
Break project up into Java and Android build/test.
Diffstat (limited to 'src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java')
-rw-r--r--src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java b/src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java
deleted file mode 100644
index f11f5cf1..00000000
--- a/src/main/java/org/whispersystems/libaxolotl/state/SignedPreKeyRecord.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.whispersystems.libaxolotl.state;
-
-import com.google.protobuf.ByteString;
-
-import org.whispersystems.libaxolotl.InvalidKeyException;
-import org.whispersystems.libaxolotl.ecc.Curve;
-import org.whispersystems.libaxolotl.ecc.ECKeyPair;
-import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
-import org.whispersystems.libaxolotl.ecc.ECPublicKey;
-
-import java.io.IOException;
-
-import static org.whispersystems.libaxolotl.state.StorageProtos.SignedPreKeyRecordStructure;
-
-public class SignedPreKeyRecord {
-
- private SignedPreKeyRecordStructure structure;
-
- public SignedPreKeyRecord(int id, long timestamp, ECKeyPair keyPair, byte[] signature) {
- this.structure = SignedPreKeyRecordStructure.newBuilder()
- .setId(id)
- .setPublicKey(ByteString.copyFrom(keyPair.getPublicKey()
- .serialize()))
- .setPrivateKey(ByteString.copyFrom(keyPair.getPrivateKey()
- .serialize()))
- .setSignature(ByteString.copyFrom(signature))
- .setTimestamp(timestamp)
- .build();
- }
-
- public SignedPreKeyRecord(byte[] serialized) throws IOException {
- this.structure = SignedPreKeyRecordStructure.parseFrom(serialized);
- }
-
- public int getId() {
- return this.structure.getId();
- }
-
- public long getTimestamp() {
- return this.structure.getTimestamp();
- }
-
- public ECKeyPair getKeyPair() {
- try {
- ECPublicKey publicKey = Curve.decodePoint(this.structure.getPublicKey().toByteArray(), 0);
- ECPrivateKey privateKey = Curve.decodePrivatePoint(this.structure.getPrivateKey().toByteArray());
-
- return new ECKeyPair(publicKey, privateKey);
- } catch (InvalidKeyException e) {
- throw new AssertionError(e);
- }
- }
-
- public byte[] getSignature() {
- return this.structure.getSignature().toByteArray();
- }
-
- public byte[] serialize() {
- return this.structure.toByteArray();
- }
-}