Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98848490
FragmentEncoded.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, 21:50
Size
1 KB
Mime Type
text/x-java
Expires
Sat, Jan 18, 21:50 (2 d)
Engine
blob
Format
Raw Data
Handle
23654989
Attached To
R3229 Genome Privacy - SHCS App
FragmentEncoded.java
View Options
package
crypto.elgamal.encoded
;
import
org.bouncycastle.math.ec.ECCurve
;
import
org.bouncycastle.math.ec.ECPoint
;
import
crypto.elgamal.ECElGamal
;
import
crypto.elgamal.FragmentEncrypted
;
public
class
FragmentEncoded
{
private
byte
[]
encodedR
;
private
byte
[]
encodedS
;
public
FragmentEncoded
(
ECPoint
R
,
ECPoint
S
)
{
this
.
encodedR
=
R
.
getEncoded
();
this
.
encodedS
=
S
.
getEncoded
();
}
public
FragmentEncoded
(
byte
[]
first
,
byte
[]
second
)
{
this
.
encodedR
=
first
;
this
.
encodedS
=
second
;
}
public
FragmentEncoded
(
FragmentEncrypted
frag
)
{
this
(
frag
.
getR
(),
frag
.
getS
());
}
public
byte
[]
getEncodedR
()
{
return
encodedR
;
}
public
byte
[]
getEncodedS
()
{
return
encodedS
;
}
public
FragmentEncrypted
decodeFragment
(
ECCurve
curve
)
{
ECPoint
pR
=
curve
.
decodePoint
(
encodedR
);
ECPoint
pS
=
curve
.
decodePoint
(
encodedS
);
return
new
FragmentEncrypted
(
pR
,
pS
);
}
public
FragmentEncrypted
decodeFragment
(
ECElGamal
ecceg
)
{
return
decodeFragment
(
ecceg
.
getECParams
().
getCurve
());
}
/**
* Size in byte of the data contained
* @return
*/
public
int
sizeByte
()
{
return
encodedR
.
length
+
encodedS
.
length
;
}
// TODO: add
// TODO: scale
}
Event Timeline
Log In to Comment