modelica / Encryption-and-Licensing

Standardized Encryption of Modelica Libraries and Artifacts
BSD 3-Clause "New" or "Revised" License
3 stars 6 forks source link

It is not possible to specify whether binary or source code export is allowed. #15

Open niklwors opened 4 months ago

niklwors commented 4 months ago

SEMLA does not support the license annotation of 18.9.2 to define whether binary or source export is possible.

record License
   String licensee = "" " Optional string to show information about the licensee ";
   String id [:] " Unique machine identifications , e.g.\ MAC addresses ";
   String features [:] = fill ("", 0) " Activated library license features ";
   String startDate = "" " Optional start date in UTCformat YYYY -MM -DD";
   String expirationDate = "" " Optional expiration date in UTCformat YYYY -MM -DD";
   String operations [:] = fill ("", 0) " Library usage conditions ";
end License ;
axelmartenssonmodelon commented 4 months ago

You wrote:

SEMLA does not support the license annotation of 18.9.2 to define whether binary or source export is possible.

If I understand you correctly, what you want to do is to add support in SEMLA for interpreting a license file. Specifically, the operations annotation: String operations[:] = fill("", 0) "Library usage conditions"; to define whether binary or source export is possible.

A design decision for the default SEMLA implementation is that it does not require the license manager to interpret anything in the Modelica code. It is expected that the Protection annotation is processed by the tool.

For context, here is the relevant section of the spec (https://specification.modelica.org/maint/3.6/annotations.html#licensing).

SEMLA already supports protecting classes using a tool specific license manager. I do not think it is necessary to also add support in SEMLA for interpreting a license file, assuming that the tool interprets the Protection annotation and license file.

The Library Vendor trusts the tool, and the tool needs to do certain checks to ensure that classess are protected.

niklwors commented 4 months ago

But this does not explain how the Modelica tool can know whether it is allowed to export code for a Model in an encrypted library, e.g. a source code FMU. Or how do you think this could be solved?

niklwors commented 4 months ago

@axelmartenssonmodelon this is the part of the specification that I meant

The format of the strings used for libraryKey and id are not specified (they are vendor specific). The libraryKey is a secret of the library developer. 
The operations define the usage conditions and the following are default names:
-    "ExportBinary" Binary code generated from the Modelica code of the library can be included in binaries produced by a simulation tool.
-    "ExportSource" Source code generated from the Modelica code of the library can be included in sources produced by a simulation tool.
axelmartenssonmodelon commented 3 months ago

To know whether binary or source code export is allowed, a tool could ask the LVE for the license file. It is the responsibility of the tool to interpret the license file, from the SEMLA perspective, it is encrypted/decrypted like any other Modelica file.

If this license file is to be used in SEMLA it must have the extension ".mo" (not ".mo_lic" which the example in the Modelica spec has), because it is only files with the ".mo" extension that get encrypted.