Skip to content

Commit

Permalink
prepare heise devsec
Browse files Browse the repository at this point in the history
  • Loading branch information
Linghui Luo committed Sep 13, 2019
1 parent 594a6dd commit d7e4920
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 125 deletions.
41 changes: 30 additions & 11 deletions monaco-example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 35 additions & 14 deletions monaco-example/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,45 @@ monaco.languages.register({
});

// create Monaco editor
const value = `package example;
const value = `import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
public class RSA {
private PublicKey publicKey;
private PrivateKey privateKey;
/**
* This code contains a misuse example CogniCrypt_SAST of a Cipher object.
* CogniCrypt_SAST reports that the string argument to Cipher.getInstance("AES/ECB/PKCS5Padding") does not correspond the CrySL specification.
*
*/
public class ConstraintErrorExample {
public static void main(String...args) throws NoSuchAlgorithmException, NoSuchPaddingException {
Cipher instance = Cipher.getInstance("AES/ECB/PKCS5Padding");
}
}
public RSA() throws NoSuchAlgorithmException {
KeyPairGenerator kpgen = KeyPairGenerator.getInstance("RSA");
kpgen.initialize(512);
KeyPair keyPair = kpgen.generateKeyPair();
this.privateKey = keyPair.getPrivate();
this.publicKey = keyPair.getPublic();
}
public byte[] sign(String message) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException {
Signature instance = Signature.getInstance("SHA256withRSA");
byte[] bytes = message.getBytes();
instance.update(bytes);
instance.sign();
return bytes;
}
public boolean verify(String message, byte[] signature)
throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
Signature instance = Signature.getInstance("SHA256withRSA");
instance.initVerify(publicKey);
instance.update(message.getBytes());
boolean isVerfied = instance.verify(signature);
return isVerfied;
}
}
`

const editor = monaco.editor.create(document.getElementById("container")!, {
Expand Down
2 changes: 1 addition & 1 deletion monaco-example/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

<body>
<h2>Monaco Example</h2>
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<div id="container" style="width:1000px;height:800px;border:1px solid grey"></div>
<script src="main.bundle.js"></script>
</html>
31 changes: 14 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<magpiebridge.version>0.0.1-SNAPSHOT</magpiebridge.version>
<magpiebridge.version>0.0.1-SNAPSHOT</magpiebridge.version>
<futuresoot.version>4.0.0.3</futuresoot.version>
<flowdroid.version>2.7.1</flowdroid.version>
<crypto.version>2.1.1</crypto.version>
<flowdroid.version>2.7.1</flowdroid.version>
<crypto.version>2.1.1</crypto.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -72,7 +72,7 @@
<artifactId>org.eclipse.lsp4j.websockets</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.15.0</version>
Expand All @@ -81,12 +81,18 @@
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.15.0</version>
</dependency>
</dependency>
<!-- flowdroid(used for Android) -->
<dependency>
<groupId>de.tud.sse</groupId>
<artifactId>soot-infoflow</artifactId>
<version>${flowdroid.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.tud.sse</groupId>
Expand Down Expand Up @@ -161,18 +167,9 @@
<target>1.8</target>
</configuration>
</plugin>
<!-- <plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin> -->
<!-- <plugin> <groupId>com.coveo</groupId> <artifactId>fmt-maven-plugin</artifactId>
<version>2.8</version> <executions> <execution> <goals> <goal>check</goal>
</goals> </execution> </executions> </plugin> -->
</plugins>
</build>
<repositories>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/CryptoDemoMain.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.io.File;
import magpiebridge.core.IProjectService;
import magpiebridge.core.MagpieServer;
import magpiebridge.core.ServerConfiguration;
import magpiebridge.projectservice.java.AndroidProjectService;
import magpiebridge.projectservice.java.JavaProjectService;
import org.apache.commons.cli.CommandLine;
Expand Down Expand Up @@ -39,7 +40,7 @@ public static void main(String... args) throws ParseException {
} else config = cmd.getOptionValue("c");
String ruleDirPath = new File(config + "/JCA_rules").getAbsolutePath();
String flowdroidConfigPath = new File(config).getAbsolutePath();
MagpieServer server = new MagpieServer();
MagpieServer server = new MagpieServer(new ServerConfiguration());
String language = "java";
if (!android) {
IProjectService javaProjectService = new JavaProjectService();
Expand Down
Loading

0 comments on commit d7e4920

Please sign in to comment.