Skip to content

Commit

Permalink
Adjust code to only use asInteger
Browse files Browse the repository at this point in the history
  • Loading branch information
rheitjoh committed Aug 5, 2021
1 parent 68ffedf commit 7c0f9a2
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed
- Made Craco an api dependency such that its API can be used. Removed Math dependency as it is now unnecessary.
- Made Craco an api dependency such that its API can be used. Removed Math dependency as it is now unnecessary
- Update Craco dependency to version 3.0.0

## [1.0.0] - 2021-03-05

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
group 'org.cryptimeleon'
archivesBaseName = project.name
boolean isRelease = project.hasProperty("release")
version = '1.1.0' + (isRelease ? "" : "-SNAPSHOT")
version = '2.0.0' + (isRelease ? "" : "-SNAPSHOT")

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -22,8 +22,8 @@ repositories {
jcenter()
}

def mathVersionNoSuffix = '2.0.0'
def cracoVersionNoSuffix = '1.1.0'
def mathVersionNoSuffix = '3.0.0'
def cracoVersionNoSuffix = '3.0.0'

dependencies {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cryptimeleon/predenc/WatersHash.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GroupElement hash(byte[] x) {
for (int i = 1; i <= T.size(); ++i) {
knownPoints.put(BigInteger.valueOf(i), T.get(i-1));
}
return LagrangeUtils.interpolateInTheExponent(knownPoints, baseHash.hash(x).getInteger());
return LagrangeUtils.interpolateInTheExponent(knownPoints, baseHash.hash(x).asInteger());
}

public List<GroupElement> getT() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public PlainText decrypt(CipherText cipherText, DecryptionKey privateKey) {
// the party linked to this share
Attribute rhoI = (Attribute) msp.getShareReceiver(omegaI.getKey());

if (!omegaI.getValue().getInteger().equals(BigInteger.ZERO)) {
if (!omegaI.getValue().asInteger().equals(BigInteger.ZERO)) {
GroupElement cI = c.getMapC().get(i);
GroupElement dI = c.getMapD().get(i);
GroupElement kRhoI = mapK.get(rhoI);
Expand All @@ -188,7 +188,7 @@ public PlainText decrypt(CipherText cipherText, DecryptionKey privateKey) {
// e(C_i, L) \cdot e(D_i, K_{\rho(i)}
map1 = map1.op(map2);
// (e(C_i, L) \cdot e(D_i, K_{\rho(i)})^{\omega_i}
map1 = map1.pow(omegaI.getValue().getInteger());
map1 = map1.pow(omegaI.getValue().asInteger());
productList.add(map1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public GroupElementPlainText decrypt(CipherText cipherText, DecryptionKey privat
// the party linked to this share
Attribute rhoI = (Attribute) msp.getShareReceiver(omegaI.getKey());

if (!omegaI.getValue().getInteger().equals(BigInteger.ZERO)) {
if (!omegaI.getValue().asInteger().equals(BigInteger.ZERO)) {
GroupElement cElementI = c.getMapC().get(i);
GroupElement dElementI = c.getMapD().get(i);
GroupElement kElementRhoI = sk.getMapKx().get(rhoI);
Expand All @@ -141,7 +141,7 @@ public GroupElementPlainText decrypt(CipherText cipherText, DecryptionKey privat
GroupElement map2 = pp.getE().apply(kElementRhoI, dElementI);

map1 = map1.op(map2);
map1 = map1.pow(omegaI.getValue().getInteger());
map1 = map1.pow(omegaI.getValue().asInteger());
zList.add(map1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public PlainText decrypt(CipherText cipherText, DecryptionKey privateKey) {
// the attribute of this row number
Attribute rho_i = (Attribute) msp.getShareReceiver(a.getKey());
// the result of alpha * row_i = S_i
BigInteger alpha = a.getValue().getInteger();
BigInteger alpha = a.getValue().asInteger();
if (!alpha.equals(BigInteger.ZERO)) {
tmp = tmp.op(pp.getE().apply(d.get(i), ct.getE().get(rho_i).pow(alpha)));
}
Expand Down Expand Up @@ -248,7 +248,7 @@ public DecryptionKey generateDecryptionKey(MasterSecret msk, KeyIndex kind) {
// M_i_u = M_i_u / t_p_i
m_i_u = (ZpElement) m_i_u.div(t_p_i);
// D_i = g^M_i_u
d.put(BigInteger.valueOf(i), pp.getG().pow(m_i_u.getInteger()).compute());
d.put(BigInteger.valueOf(i), pp.getG().pow(m_i_u.asInteger()).compute());
}
} catch (NullPointerException e) {
throw new WrongAccessStructureException("The attributes provided in the identity are not in the universe.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected GroupElement restoreYs(ABEKPGPSW06DecryptionKey sk, ABEKPGPSW06KEMCiph
// the terms would be 1 anyway.
Supplier<Stream<Map.Entry<Integer, Zp.ZpElement>>> nonZeroSVElements = () ->
solvingVector.entrySet().parallelStream()
.filter(elem -> !value.apply(elem).getInteger().equals(BigInteger.ZERO));
.filter(elem -> !value.apply(elem).asInteger().equals(BigInteger.ZERO));

// \prod_{i \in \omega} e(R_i^{-w_i}, E_{\rho(i)})
GroupElement factor1 = nonZeroSVElements.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public TransformationAndDecryptionKey generateTransformationKey(
/*get blinding for ElGamal private key*/
ZnElement z = zp.getUniformlyRandomElement();

return generateTransformationKey(original, z.getInteger());
return generateTransformationKey(original, z.asInteger());
}

public TransformationAndDecryptionKey generateTransformationKey(
Expand Down

0 comments on commit 7c0f9a2

Please sign in to comment.