Can TweetNaCl box sender's private key be set to "1" without privacy loss? The use case is: I need to encrypt data such that only my own private key can be used to decrypt it, from a machine that only knows my public key.

I'd prefer not to have to create and keep track of a sender key pair in addition to my own key pair. I understand that by setting the sender private key to "1" I will not be able to properly authenticate the sender of the message as being myself, but I am happy to accept that.

Related question 1: If a proper sender key pair was used (using a random private key rather than a "1" private key), can the encrypted message be decrypted using only the sender's private key and knowledge of my public key? Edit: Clarification: The receiver (me) would be told the public key of the sender key pair. The crux of the question was about whether if the encrypted message, the sender private key and my public key were all known, could the message be decrypted without my private key?

Related question 2: Is it OK to use the same key pair for both the sender and recipient when using the Box? This would mean a third party can authenticate the message as being encrypted by me, using only the public key.
It is possible to decrypt the message using either the receiver's private key together with the sender's public key or using the sender's private key together with the receiver's public key. This means that if either private key is public, you end up with a completely broken system.

What you should do instead, is generating an ephemeral key-pair for the sender and sending the public part of it alongside the message. This essentially turns crypto_box into ECIES.



Using the same keypair for both sender and receiver is possible in principle, but silly, because then you end up with symmetric authenticated encryption and you should use the cheaper crypto_secretbox function instead.

Note that you need to know the shared key to verify, which at the same time allows forgeries. So this is typically only a workable solution if you have at most two parties. When you need a party who can verify but not sign, you should use a signature scheme instead. NaCl includes Ed25519.