Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96793372
FragmentEncodedTest.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 30, 22:00
Size
808 B
Mime Type
text/x-java
Expires
Wed, Jan 1, 22:00 (2 d)
Engine
blob
Format
Raw Data
Handle
23227039
Attached To
R3229 Genome Privacy - SHCS App
FragmentEncodedTest.java
View Options
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
Log In to Comment