- Can you do this? Yes
- Will they abide by it? Quite possibly not
- Is it still worth doing? Maybe
As someone who cares about a fair and just society, it's important to remember than a license is one of many tools in your tool box, so you need to ask:
a) How will this tool serve my goals?
b) What other tools would be better used and should I be using those instead / as well?
Is this technically possible?
Yes. But as others have pointed out, there are legal and practical challenges to this being effective.
Who do you want to exclude?
You may also want to consider the scope of this limitation. Are you specifically only concerned about the NSA using it?
What about regular law enforcement?
The Australian Signals Directorate (aka ASD, a kind of Australian version of the NSA)?
If you don't exclude the ASD, then are you happy with the NSA asking the ASD to use your work on their behalf to achieve the same end?
How does this tool serve my goals?
If the NSA doesn't want to abide by your terms, what will they do about it and what does that mean?
This could mean you mounting a court case, it could mean them lobbying law makers to change the laws, it could mean they just use it and don't tell anyone.
Whether or not these things work in themselves is not the only question. If you work with organisations that advocate for civil society rights, these actions give them tools to garner publicity and public support.
If law makers were to try and change law to make law enforcement agencies above certain laws, you can see how there's an opportunity to start a public conversation there.
What other tools are better used?
From what you've described, it sounds like your work does not substantively advance the field, in that case, maybe the NSA will already have the tools they need at their disposal.
In which case, the better protections against the misuse of such tools is to work with organisations in the field to influence public support for curtailing such operations.
At the end of the day, what the government institutions can and cannot do is governed by what society is willing to permit / tolerate. Working to build broad enough support to change that may ultimately be a more effective and long term way of preventing what you fear your tool will be used for (and the way you choose to license it and fight for that license may be a tactic in that
You might want to consider the trajectory of ideas like defund the police (which were around long before last year, but used political moments to advance support).
This thread discussing ethical licensing may be of interest on the technical aspects.