Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98811227
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
Thu, Jan 16, 14:59
Size
848 B
Mime Type
text/x-java
Expires
Sat, Jan 18, 14:59 (1 d, 20 h)
Engine
blob
Format
Raw Data
Handle
23650119
Attached To
R3229 Genome Privacy - SHCS App
FragmentEncodedTest.java
View Options
package
crypto.elgamal.encoded
;
import static
org.junit.Assert.*
;
import
java.math.BigInteger
;
import
org.bouncycastle.asn1.nist.NISTNamedCurves
;
import
org.junit.Test
;
import
crypto.elgamal.ECElGamal
;
import
crypto.elgamal.FragmentEncrypted
;
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