Page MenuHomec4science

FragmentEncodedTest.java
No OneTemporary

File Metadata

Created
Mon, Dec 30, 22:00

FragmentEncodedTest.java

package crypto.elgamal.fragment;
import static org.junit.Assert.*;
import java.math.BigInteger;
import org.bouncycastle.asn1.nist.NISTNamedCurves;
import org.junit.Test;
import crypto.elgamal.ECElGamal;
public class FragmentEncodedTest {
@Test
public void testDecodeFragment() {
ECElGamal eccegScheme = new ECElGamal(NISTNamedCurves.getByName("P-384"));
eccegScheme.initReverseDLTable();
BigInteger msg = new BigInteger("7");
FragmentEncrypted fragEncrypted = eccegScheme.encrypt(msg);
FragmentEncoded fragEncoded = fragEncrypted.getFragmentEncoded();
FragmentEncrypted fragEncrypted2 = fragEncoded.decodeFragment(eccegScheme.getECParams().getCurve());
BigInteger msgDecrypted2 = eccegScheme.decrypt(fragEncrypted2);
assertTrue("Encoding", msg.equals(msgDecrypted2));
}
}

Event Timeline