Is it okay to use "optionally" in a claim?
No, for two reasons.
The purpose of an independent claim is to define the scope of the protection that you seek. Including an optional feature does not serve this aim (since you intend for it not to be a limitation on the scope), and so should not be included.
Moreover, it could unintentionally be an implicit limitation anyway. In your case, you are providing that the connection is optionally encrypted. This could be construed as meaning that encryption of the connection must be possible (else it wouldn't be an option). It therefore potentially excludes a situation in which a connection could not be encrypted for whatever reason. This is almost certainly not what you intended, but you are needlessly running a risk.
You are right in that there is an analogy to "one or more Xs". This requires one X, and arguably also requires that plural Xs are possible. In most cases, drafters would be better served by just saying "an X", since that avoids a potential implicit limitation.
The purpose of a dependent claim is to include features which provide a further distinction from the prior art, but are not essential to the broadest conception of the invention. In other words, every feature in the dependent claims is an optional feature. It is not petty: it is why dependent claims exist.