The OPAQUE protocol is an asymmetric password-authenticated key-exchange. Essentially it allows a client
to establish a shared secret with a server based on only having a password. The client doesn’t need to
store any state. The protocol has two phases:
• In the initialization phase a client registers with the server.
• In the AKE phase the client and server establish a shared secret.
The initialization only needs to be executed once, the key-exchange can be executed as many times as
necessary.
Initialization
Initializing OPAQUE (registration) can be done either online or offline. The online variant has the
benefit that the server never learns anything about the users password, with the drawback that this
requires 3 messages to be exchanged by the client and the server.
The offline initialization is much easier, however either the user learns the servers secret, or the
server learns the users password. The latter might be useful if some organisation wants to enforce some
password quality rules and check those upon registration. The drawback is that either way, some
sensitive information leaks to the other party.
OfflineRegistration
echo -n password | ./opaque init user server >record 3>export_key
OnlineRegistrationsocatstyle
On the server:
socat tcp-l:23523,reuseaddr,fork system:"bash -c \'opaque server-reg user server 3>record\'"
On the client:
socat tcp:127.0.0.1:23523 exec:'bash -c \"opaque user-reg user server 3< <(echo -n password) 4>export_key\"'
tcpserverstyle
On the server:
s6-tcpserver 127.0.0.1 23523 bash -c 'opaque server-reg user server 3>record'
On the client:
s6-tcpclient 127.0.0.1 23523 bash -c "opaque user-reg user server <&6 >&7 3< <(echo -n password) 4>export_key"
Manually
It’s possible to do all 4 steps seperately, in case you cannot connect to the server directly, then:
The user initiates with:
echo -n password | opaque register >msg 3>ctx
The server gets msg and responds with rpub, while keeping rsec secret:
cat msg | opaque respond >rpub 3>rsec
The user receives rpub and creates stub record and optionally uses the export key to encrypt more data:
cat ctx | opaque finalize user server 4<rpub >record 3>export_key
the server finalizes the record by completing the stub record from the client:
cat rec | opaque store user server >record 3<rsec
RunningOPAQUEtcpserverstyle
On the server:
s6-tcpserver 127.0.0.1 23523 bash -c './opaque server user server context 3<record 4>shared_secret'
On the client:
s6-tcpclient 127.0.0.1 23523 bash -c "./opaque user user server context <&6 >&7 3< <(echo -n password) 4>export_key 5>shared_secret"
socatstyle
On the server:
socat tcp-l:23523,reuseaddr,fork system:"bash -c \'./opaque server user server context 3<record 4>shared_secret\'"
On the client:
socat tcp:127.0.0.1:23523 exec:'bash -c \"./opaque user user server context 3< <(echo -n password) 4>export_key 5>shared_secret\"'