Hi, I'm conducting academic research on Java Cryptography API based misuse using your tool. After reading the paper and source codes, I believe that your team have implemented the rules to detect the RSA cipher with keysize < 2048 bits. I tried my test codes using 512-bit RSA , however, with no warnings. I also tried to use a default keysize (2048 bits) RSA to encrypt messages. Strangely, this time cryptoguard reported an issue saying : "Cause: Used default key size". I'm confused ,since by far, 2048-bit RSA is a secure cipher and cryptoguard arises a warning. Some improval in InsecureAssymCryptoFinder.java may help to solve this issue. I'm also trying to find ways to solve this missed-detection problem.
Updated : 3.25.
I've debugged the source code. Finally , I find that for some codes, cryptoguard can correctly identify the RSA small size key misuse , but for the above codes, it can't. The bug is from this line : java/rule/ExportGradeKeyInitializationFinder.java: 88.
The two strings here may seem like this:
It's strange but I'm not going to figure out the deeper reason causing strings like this. Logically speaking, the two strings indicate the same line in the source code, so the checking should be passed to do more slicing analysis. I simply parse the line number in the original strings and compare them to determine whether we should analyze more or return right here.
A simple demo here :
if (!(initializationCallsites.toString().contains(keyInitializationSite))) {
String regEx = "[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m1 = p.matcher(initializationCallsites.toString());
Matcher m2 = p.matcher(keyInitializationSite);
try {
int i1 = Integer.valueOf(m1.replaceAll("").trim());
int i2 = Integer.valueOf(m2.replaceAll("").trim());
if (i1 != i2) {
return;
}
} catch (NumberFormatException e) {
return;
}
}
Hopefully, you may have better ways to solve this issue.
Hi, I'm conducting academic research on Java Cryptography API based misuse using your tool. After reading the paper and source codes, I believe that your team have implemented the rules to detect the RSA cipher with keysize < 2048 bits. I tried my test codes using 512-bit RSA , however, with no warnings. I also tried to use a default keysize (2048 bits) RSA to encrypt messages. Strangely, this time
cryptoguard
reported an issue saying : "Cause: Used default key size". I'm confused ,since by far, 2048-bit RSA is a secure cipher andcryptoguard
arises a warning. Some improval inInsecureAssymCryptoFinder.java
may help to solve this issue. I'm also trying to find ways to solve this missed-detection problem.The test codes :
Updated : 3.25. I've debugged the source code. Finally , I find that for some codes,
cryptoguard
can correctly identify the RSA small size key misuse , but for the above codes, it can't. The bug is from this line : java/rule/ExportGradeKeyInitializationFinder.java: 88. The two strings here may seem like this:It's strange but I'm not going to figure out the deeper reason causing strings like this. Logically speaking, the two strings indicate the same line in the source code, so the checking should be passed to do more slicing analysis. I simply parse the line number in the original strings and compare them to determine whether we should analyze more or return right here. A simple demo here :
Hopefully, you may have better ways to solve this issue.