How to create encrypted spice subcircuit/schematic and use it as symbol in other schematics?

In LTspice XVIIx64 I want to create a subcircuit and use it in other schematics but the content of the subcircuit should not be visible to other users. The users are students who are advised to find out the content/components of a filter or resonant circuit by doing AC analysis.

I know how to create subcircuits in LTSpice and how to define symbols and use them in other schematics. However there is the disadvantage the I have to supply symbol and corresponding asy-Schematic in order that the symbol can be used in the top schematic. By suppling the asy-schematic the components values can be seen by opening the file. There is also the -encrypt function in LTspice as a xviix64.exe execution command and I am able to encrypt the underlining asy schematic. Creating a symbol for it and placing it in the top level schematic results in simulation that LTspice says: "Trouble generating netlist for SPICE run".

Are there any other possibilities to get this working?

• Not that familiar with LTSpice, but is there any way you could use something like an s-parameter block of your resonant circuit? – Joren Vaes Mar 25 at 8:31

The -encrypt command line switch is only valid for subcircuits, not schematics, or hierarchical schematics. As the manual says in Modes of Operation > Command Line Switches:

Encrypt a model library. For 3rdparties wishing to allow people to use libraries without revealing implementation details. Not used by Linear Technology Corporation models.

XVII.exe -encrypt /path/to/subcircuit.sub


The extension is really just for your convenience, LTspice will read the file and detect wether it's a schematic (.asc) or library (.sub, .lib, .net, .cir, etc). That is, LTspice will encrypt the file you provide, but when reading it must be of the subcircuit/netlist type.

Caveat emptor: the subcircuit will be deleted and replaced by the encrypted version! So if you still need your subcircuit to be avaliable to you, make a copy first, before encrypting.

• Well that is what I thought in the beginning, that schematics (.asc) are of the subcircuit/netlist type. But know I see that you are right. They are not of a netlist type. Seems to me that I have to create the subcircuit netlist manually, or at least create a schematic and then display the netlist data through Ltspice and creating from it a .cir file with .SUBCKT command in the beginning. This is in fact working as I can encrypt it and use it in top level schematics with a block/cell symbol. Thanks. – hendrik2k1 Mar 26 at 6:58
• @hendrik2k1 When you have the schematic opened, use the menu View > SPICE Netlist, and it will get you your netlist that you need. This is usually the step performed when converting hierarchical, or any other schematics to libraries. – a concerned citizen Mar 26 at 14:25