aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java')
-rw-r--r--libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java53
1 files changed, 0 insertions, 53 deletions
diff --git a/libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java b/libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java
deleted file mode 100644
index aed4a6253..000000000
--- a/libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/parsers/ECIESPublicKeyParser.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.spongycastle.crypto.parsers;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.spongycastle.crypto.KeyParser;
-import org.spongycastle.crypto.params.AsymmetricKeyParameter;
-import org.spongycastle.crypto.params.ECDomainParameters;
-import org.spongycastle.crypto.params.ECPublicKeyParameters;
-
-public class ECIESPublicKeyParser
- implements KeyParser
-{
- private ECDomainParameters ecParams;
-
- public ECIESPublicKeyParser(ECDomainParameters ecParams)
- {
- this.ecParams = ecParams;
- }
-
- public AsymmetricKeyParameter readKey(InputStream stream)
- throws IOException
- {
- byte[] V;
- int first = stream.read();
-
- // Decode the public ephemeral key
- switch (first)
- {
- case 0x00: // infinity
- throw new IOException("Sender's public key invalid.");
-
- case 0x02: // compressed
- case 0x03: // Byte length calculated as in ECPoint.getEncoded();
- V = new byte[1 + (ecParams.getCurve().getFieldSize()+7)/8];
- break;
-
- case 0x04: // uncompressed or
- case 0x06: // hybrid
- case 0x07: // Byte length calculated as in ECPoint.getEncoded();
- V = new byte[1 + 2*((ecParams.getCurve().getFieldSize()+7)/8)];
- break;
-
- default:
- throw new IOException("Sender's public key has invalid point encoding 0x" + Integer.toString(first, 16));
- }
-
- V[0] = (byte)first;
- stream.read(V, 1, V.length - 1);
-
- return new ECPublicKeyParameters(ecParams.getCurve().decodePoint(V), ecParams);
- }
-}