-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...nalysisTargets/ReportedIssues/src/main/java/issue208/Issue208WithMultipleEntryPoints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package issue208; | ||
|
||
import javax.crypto.spec.IvParameterSpec; | ||
import java.security.SecureRandom; | ||
|
||
public class Issue208WithMultipleEntryPoints { | ||
|
||
private final SecureRandom secureRandom = new SecureRandom(); | ||
|
||
private static final int IV_LENGTH = 32; | ||
|
||
private void encryptImpl() { | ||
byte[] iv = new byte[IV_LENGTH]; | ||
secureRandom.nextBytes(iv); | ||
|
||
// iv has to ensure 'randomized' | ||
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...toAnalysisTargets/ReportedIssues/src/main/java/issue208/Issue208WithSingleEntryPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package issue208; | ||
|
||
import javax.crypto.spec.IvParameterSpec; | ||
import java.security.SecureRandom; | ||
|
||
public class Issue208WithSingleEntryPoint { | ||
|
||
private final SecureRandom secureRandom = new SecureRandom(); | ||
|
||
private static final int IV_LENGTH = 32; | ||
|
||
private void encryptImpl() { | ||
byte[] iv = new byte[IV_LENGTH]; | ||
secureRandom.nextBytes(iv); | ||
|
||
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); | ||
} | ||
|
||
public static void main(String[] args) { | ||
// Method 'main' is the single entry point -> Instantiate SecureRandom seed and | ||
// use it in 'encryptImpl' | ||
Issue208WithSingleEntryPoint issue208 = new Issue208WithSingleEntryPoint(); | ||
issue208.encryptImpl(); | ||
} | ||
} |