Page MenuHomec4science

FragmentEncoded.java
No OneTemporary

File Metadata

Created
Tue, Jan 7, 00:06

FragmentEncoded.java

package crypto.elgamal;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.math.ec.ECPoint;
public class FragmentEncoded {
private byte[] first;
private byte[] second;
public FragmentEncoded(ECPoint first, ECPoint second) {
this.first = first.getEncoded();
this.second = second.getEncoded();
}
public FragmentEncoded(FragmentEncrypted frag) {
this(frag.getR(), frag.getS());
}
public byte[] getFirst() {
return first;
}
public byte[] getSecond() {
return second;
}
public FragmentEncrypted decodeFragment(ECCurve curve) {
ECPoint pFirst = curve.decodePoint(first);
ECPoint pSecond = curve.decodePoint(second);
return new FragmentEncrypted(pFirst, pSecond);
}
/**
* Size in byte of the data contained
* @return
*/
public int sizeByte() {
return first.length + second.length;
}
// TODO: add
// TODO: scale
}

Event Timeline