eclipse-cognicrypt / CogniCrypt

CogniCrypt is an Eclipse plugin that supports Java developers in using Java Cryptographic APIs.
Eclipse Public License 2.0
61 stars 23 forks source link

Templates for Secure Communication Task require cast operator #346

Open AndreSonntag opened 4 years ago

AndreSonntag commented 4 years ago

Context

The templates for the client-side as well the server-side use factory classes and cast operators like in the following code snippet for the TLSClient:

public TLSClient(String host, int port) throws UnknownHostException, IOException {
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(host, port);**  

sslsocket.setEnabledCipherSuites(new String[] {"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"});
sslsocket.setEnabledProtocols(new String[] { "TLSv1.2", "TLSv1.1"});
sslsocket.startHandshake();
}

Describe the bug/new feature

Currently, it is not possible to generate a cast construct like in the initialization line of SSLSocketFactory and SSLSocket via the new CrySL code generation. Furthermore, the CrySL syntax does not support cast operators or something similar to depict the described situation.

AndreSonntag commented 4 years ago

@kruegers

kruegers commented 4 years ago

Can you please push the template somewhere? I'd like to be able to debug the feature while developing it. Thanks.