diff --git a/build/classes/java/test/PseudonymTest.class b/build/classes/java/test/PseudonymTest.class index b094634..d1fd7be 100644 Binary files a/build/classes/java/test/PseudonymTest.class and b/build/classes/java/test/PseudonymTest.class differ diff --git a/build/tmp/compileTestJava/previous-compilation-data.bin b/build/tmp/compileTestJava/previous-compilation-data.bin index 0e9e833..82afd1c 100644 Binary files a/build/tmp/compileTestJava/previous-compilation-data.bin and b/build/tmp/compileTestJava/previous-compilation-data.bin differ diff --git a/src/main/java/com/ibm/unlinkablepseudonyms/Pseudonym.java b/src/main/java/com/ibm/unlinkablepseudonyms/Pseudonym.java index aaec1c4..a540498 100644 --- a/src/main/java/com/ibm/unlinkablepseudonyms/Pseudonym.java +++ b/src/main/java/com/ibm/unlinkablepseudonyms/Pseudonym.java @@ -1,7 +1,6 @@ package com.ibm.unlinkablepseudonyms; import org.apache.commons.codec.digest.DigestUtils; - import java.math.BigInteger; import java.security.interfaces.RSAPrivateCrtKey; import java.security.interfaces.RSAPublicKey; @@ -23,7 +22,11 @@ public static byte[] convert( byte[] cipher, PRFSecretExponent currentSecretExponent, PRFSecretExponent targetSecretExponent, - RSAPrivateCrtKey privateKey) { + RSAPrivateCrtKey privateKey) throws Exception { + + if (privateKey.getModulus().bitLength() <= 256) { + throw new Exception("key size to small"); + } BigInteger phi = privateKey.getPrimeP().subtract(BigInteger.ONE).multiply(privateKey.getPrimeQ().subtract(BigInteger.ONE)); BigInteger value = (new BigInteger(cipher)).modPow(targetSecretExponent.asBigInt(), privateKey.getModulus());