|
1 | 1 | # SEMLA:<br/>Tool-independent Licensing and Code Encryption of Modelica Libraries
|
2 | 2 |
|
3 |
| -## Revision history |
4 |
| - |
5 |
| -| Version | Changes/Comments | Author/Date | |
6 |
| -|---------|----------------------------------------------------------------------------------------------|-------------------------------------------------| |
7 |
| -| 0.1 | Initial version | Jesper Mattsson, 2015 | |
8 |
| -| 0.2 | Restructuring to separate out requirements and examples as appendices, minor wording updates | Hubertus Tummescheit, April 9<sup>th</sup> 2021 | |
9 |
| - |
10 | 3 | This specification describes a container for distributing Modelica
|
11 | 4 | libraries and a protocol for how a Modelica tool should communicate with
|
12 | 5 | an executable for licensing and decryption of the library. The following
|
@@ -437,304 +430,3 @@ and fourth form below:
|
437 | 430 | decimal integer – must fit in a 32-bit signed integer
|
438 | 431 |
|
439 | 432 | - <data> = the data, as raw bytes
|
440 |
| - |
441 |
| -# References |
442 |
| - |
443 |
| -\[1\] TLS 1.2 official specification: |
444 |
| -<https://tools.ietf.org/html/rfc5246> |
445 |
| - |
446 |
| -# Appendix A: Example “manifest.xml” file |
447 |
| - |
448 |
| -This is an example of what the “manifest.xml” file could look like for |
449 |
| -an example encrypted library: |
450 |
| - |
451 |
| -<?xml version=*"1.0"* encoding=*"utf-8"*?> |
452 |
| - |
453 |
| -<archive> |
454 |
| - |
455 |
| -<!-- All paths in the file are interpreted as relative to the |
456 |
| -directory of the top-level |
457 |
| - |
458 |
| -package (e.g., the path to this file would be ".library/manifest.xml"), |
459 |
| -and allows |
460 |
| - |
461 |
| -only forward slashes as directory separators. --> |
462 |
| - |
463 |
| -<manifest version=*"1.0"*/> |
464 |
| - |
465 |
| -<!-- The id attribute is the actual Modelica identifier of the |
466 |
| -library. The file attribute |
467 |
| - |
468 |
| -from SMA is no longer needed, as it will always be "package.mo" or |
469 |
| -"package.moc" |
470 |
| - |
471 |
| -(and the tool will need the logic of checking for both .mo and .moc |
472 |
| -anyway). |
473 |
| - |
474 |
| -The enabled attribute (optional, default value is true) indicates |
475 |
| -whether the library |
476 |
| - |
477 |
| -should be enabled/loaded by default. --> |
478 |
| - |
479 |
| -<library id=*"ExampleLib"* enabled=*"true"*> |
480 |
| - |
481 |
| -<!-- Official title of the library (optional) --> |
482 |
| - |
483 |
| -<title>Example Encrypted Library</title> |
484 |
| - |
485 |
| -<!-- Description (optional) --> |
486 |
| - |
487 |
| -<description> |
488 |
| - |
489 |
| -Dummy library showing directory structure for an encrypted library (with |
490 |
| -empty files) |
491 |
| - |
492 |
| -</description> |
493 |
| - |
494 |
| -<!-- The version of the library. Version information is formatted |
495 |
| -according to the |
496 |
| - |
497 |
| -Modelica language specification. The build and date attributes are |
498 |
| -optional. --> |
499 |
| - |
500 |
| -<version number=*"1.0"* build=*"1"* date=*"2013-08-04"*/> |
501 |
| - |
502 |
| -<!-- Version of the Modelica language that is used in this library. |
503 |
| ---> |
504 |
| - |
505 |
| -<language version=*"3.2"* /> |
506 |
| - |
507 |
| -<!-- Copyright notice (optional)--> |
508 |
| - |
509 |
| -<copyright> |
510 |
| - |
511 |
| -Copyright © 2014, Modelon AB. |
512 |
| - |
513 |
| -</copyright> |
514 |
| - |
515 |
| -<!-- License information (optional) --> |
516 |
| - |
517 |
| -<license> |
518 |
| - |
519 |
| -Some license information. |
520 |
| - |
521 |
| -</license> |
522 |
| - |
523 |
| -<!-- Encryption/license check information (only for proprietary |
524 |
| -libraries). |
525 |
| - |
526 |
| -If this is present, then the library is encrypted. --> |
527 |
| - |
528 |
| -<encryption> |
529 |
| - |
530 |
| -<!-- Library vendor executable. May be repeated - one for each |
531 |
| -supported platform. |
532 |
| - |
533 |
| -path: the path to the executable |
534 |
| - |
535 |
| -platform: the OS/platform to use this executable on, must be unique |
536 |
| -among |
537 |
| - |
538 |
| -executable nodes |
539 |
| - |
540 |
| -licensing: if this executable handles licensing (optional, default is |
541 |
| -true) |
542 |
| - |
543 |
| -The executable shall be placed under the vendor-specific directory |
544 |
| - |
545 |
| -(i.e. .library/VENDORNAME/). The normal case is that licensing has the |
546 |
| -same |
547 |
| - |
548 |
| -value for each executable node, but it is allowed to have different |
549 |
| -values |
550 |
| - |
551 |
| -for different platforms. --> |
552 |
| - |
553 |
| -<executable path=*".library/Modelon/vendor.exe"* platform=*"win32"* |
554 |
| -licensing=*"true"* /> |
555 |
| - |
556 |
| -<executable path=*".library/Modelon/vendor32"* platform=*"linux32"* |
557 |
| -licensing=*"true"* /> |
558 |
| - |
559 |
| -<executable path=*".library/Modelon/vendor64"* platform=*"linux64"* |
560 |
| -licensing=*"true"* /> |
561 |
| - |
562 |
| -</encryption> |
563 |
| - |
564 |
| -<!-- Icon for the library (PNG format) (optional) --> |
565 |
| - |
566 |
| -<icon file=*"Resources/Images/el.png"* /> |
567 |
| - |
568 |
| -</library> |
569 |
| - |
570 |
| -<!-- Leaving out optional compatibility and dependencies in this |
571 |
| -example. --> |
572 |
| - |
573 |
| -</archive> |
574 |
| - |
575 |
| -# Appendix B: Discussion of Weaknesses |
576 |
| - |
577 |
| -There are several cryptographic keys involved. If someone were to |
578 |
| -extract a key from an executable or alter the executable to change the |
579 |
| -key, then that would have different consequences depending on what key |
580 |
| -it is: |
581 |
| - |
582 |
| -- The private key of the tool |
583 |
| - |
584 |
| - - Finding this key would allow decryption of all libraries that |
585 |
| - trust that key. It would be possible to replace the key, but |
586 |
| - that would require new releases (or at least new distributable) |
587 |
| - of all libraries that trust that tool. |
588 |
| - |
589 |
| - - Altering this key would not be useful for an attacker. |
590 |
| - |
591 |
| -- The private key of the LVE |
592 |
| - |
593 |
| - - It might be possible to eavesdrop on the communication between |
594 |
| - tool and LVE with this key. Requires additional study of chosen |
595 |
| - crypto scheme to determine. With private key of tool as well, it |
596 |
| - is definitely possible (but uninteresting if you have that key). |
597 |
| - |
598 |
| -- The session key |
599 |
| - |
600 |
| - - Generated for each communication session, but could be extracted |
601 |
| - for a specific communication by debugging the tool or LVE. |
602 |
| - |
603 |
| - - Finding this would allow eavesdropping on the communication. |
604 |
| - |
605 |
| - - Altering this key is not possible. |
606 |
| - |
607 |
| -- List of public keys that the LVE trusts |
608 |
| - |
609 |
| - - Finding this list would not be useful for an attacker. |
610 |
| - |
611 |
| - - Altering this list would allow adding your own and thus allow |
612 |
| - decryption of the library. |
613 |
| - |
614 |
| -- The key/keys used by the LVE to decrypt the library |
615 |
| - |
616 |
| - - Finding this key would allow decrypting the library. |
617 |
| - |
618 |
| - - Altering this key would not be useful for an attacker. |
619 |
| - |
620 |
| -Note that both the public/private key pair in the LVE and the key used |
621 |
| -to decrypt the library could be newly generated for each build of the |
622 |
| -library distributable. |
623 |
| - |
624 |
| -All of these keys should be protected with some sort of obfuscation of |
625 |
| -the object code to make them harder to extract. It would, however, be |
626 |
| -impossible to completely protect against such attacks. |
627 |
| - |
628 |
| -In conclusion, the most serious breach would be if an attacker obtained |
629 |
| -the private key of the tool, allowing decryption of any library released |
630 |
| -for that tool. The current situation is that the same vulnerability |
631 |
| -necessarily exists in any tool that supports encrypted libraries. |
632 |
| - |
633 |
| -Since Modelica tools need access to the Modelica source code by the |
634 |
| -nature of the language specification, theses weaknesses have been |
635 |
| -considered acceptable by all commercial parties that so far have made |
636 |
| -use of this feature. The weaknesses are identical to those of |
637 |
| -tool-specific encryption schemes. |
638 |
| - |
639 |
| -# Appendix C: Requirements considered for the design of SEMLA |
640 |
| - |
641 |
| -The following requirements for commercial libraries were considered in |
642 |
| -the design of this proposal: |
643 |
| - |
644 |
| -## Library Vendor |
645 |
| - |
646 |
| -- Library vendor needs to be able to define which libraries that |
647 |
| - should be available on which tools, i.e. explicit encoding of |
648 |
| - supported tools. *Yes, through list of trusted keys.* |
649 |
| - |
650 |
| -<!-- --> |
651 |
| - |
652 |
| -- Library vendor needs to be able to enable/disable parts (features) |
653 |
| - in any given library based on standardized annotations. *Not |
654 |
| - hindered, standard license annotations are used.* |
655 |
| - |
656 |
| -- Library vendor needs to be able to specify visibility of components |
657 |
| - based on the standardized annotations. *Not hindered, standard |
658 |
| - license annotations are used.* |
659 |
| - |
660 |
| -- The solution should offer a means to check the license for the |
661 |
| - library as a whole without parsing the Modelica code. *Yes, optional |
662 |
| - alternate licensing mechanism can be used for tools that do not |
663 |
| - understand license annotations.* |
664 |
| - |
665 |
| -- Library vendor needs to be able to license/protect external |
666 |
| - libraries written in e.g. C and Fortran 77 independently of the |
667 |
| - licensing mechanism for the library. *Not affected by this |
668 |
| - specification, such checks can be added to the external libraries |
669 |
| - themselves.* |
670 |
| - |
671 |
| -- Library vendor needs to be able to make new releases of existing |
672 |
| - libraries and release new libraries without any action from the tool |
673 |
| - vendor. *Yes, when licensing is supplied by library vendor.* |
674 |
| - |
675 |
| -- Encryption mechanism shall be possible to use with or without the |
676 |
| - licensing mechanism of the protocol. *Yes.* |
677 |
| - |
678 |
| -- Encryption mechanism shall ensure protection of library vendor IP. |
679 |
| - (In this case, this is defined only as Modelica source code.) *In |
680 |
| - part. It is not possible to fulfill this completely, since |
681 |
| - everything necessary to decrypt the code must be available to the |
682 |
| - client computer. Protection is also limited by what the tool does or |
683 |
| - does not expose to the user. Extracting any IP that is not shown by |
684 |
| - the tool requires using decompilation and/or debugging tools to |
685 |
| - extract cryptographic keys from either the tool or the LVE (see |
686 |
| - Weaknesses below). This is similar to the current situation.* |
687 |
| - |
688 |
| -- The solution shall be not be limited to a specific licensing |
689 |
| - mechanism. *Yes, license mechanism is not specified. It is required |
690 |
| - that feature names are used, but this is also assumed by the |
691 |
| - description of licensing annotations in the Modelica language |
692 |
| - specification.* |
693 |
| - |
694 |
| -- The protocol shall offer means to with reasonable effort replace |
695 |
| - encryption keys, or equivalent, in cases of security breaches. *All |
696 |
| - involved keys belonging to library vendors can be switched for any |
697 |
| - library release. Changing the key pair used by the tool could be |
698 |
| - done by adding a second key pair during a transition period. Library |
699 |
| - vendors could then replace the compromised key with the new one in |
700 |
| - their list of trusted tools. A tool may have more than one key pair. |
701 |
| - For tools that have more than one key pair, the LVE needs to be |
702 |
| - restarted in between trying different key pairs.* |
703 |
| - |
704 |
| -## Tool Vendor |
705 |
| - |
706 |
| -- A tool may store all files except Modelica source code on disc in |
707 |
| - unencrypted form, e.g., in order to support linking with library |
708 |
| - files during compilation. *Yes.* |
709 |
| - |
710 |
| -- The solution shall support standardized mechanisms for |
711 |
| - enabling/disabling parts of a library, by means of annotations |
712 |
| - defined in the Modelica specification. *Not hindered, standard |
713 |
| - license annotations are used.* |
714 |
| - |
715 |
| -- Well documented low-level API for licensing and encryption for easy |
716 |
| - integration in applications. *Documented above.* |
717 |
| - |
718 |
| -- Solution shall enable customizations and tailored functionality on |
719 |
| - top of the low-level API. *API is fairly generic and uses |
720 |
| - file-system model, this enables customizations through special files |
721 |
| - or folders.* |
722 |
| - |
723 |
| -- Error messages must be supported by the API. *Yes, error messages |
724 |
| - can be passed back to tool.* |
725 |
| - |
726 |
| -- Alternative, tool specific, licensing mechanisms shall not be |
727 |
| - prevented by the API. *Yes, license checking is controlled by tool.* |
728 |
| - |
729 |
| -- It shall be possible to store/ship several libraries/top-level |
730 |
| - packages in a single file. *Yes.* |
731 |
| - |
732 |
| -## User |
733 |
| - |
734 |
| -- The API shall enable convenient to installation procedures for |
735 |
| - libraries. *Possible with tool support, library is distributed as a |
736 |
| - single file with a well-defined file extension.* |
737 |
| - |
738 |
| -- Error messages should enable users and support personnel to isolate |
739 |
| - errors related to licensing and encryption. *Yes, error messages can |
740 |
| - be passed back to tool.* |
0 commit comments