%! make_login_cookie(+UName:atom, -Cookie:string) is semidet
% Make the contents (a string of hex) of a persistent login cookie
% * the passed in user name
% * the rememberme_duration
% * a secret generated and stored in file
make_login_cookie(UName, Cookie) :-
Expires is floor(Now + DurSecs),
atomics_to_string([URLEncodedUName, "/", Expires], PlainText),
% next line throws
Key, Nonce, CipherText, ),
append(Nonce, CipherTextCodes, TokenList),
crypto:'_crypto_data_encrypt'/8: Domain error: `cipher' expected, found `'chacha20-poly1305''
I presume the correct thing to pass is in the foreign library crypto4pl, but I’m reluctant to select randomly, as this has security implications.
Works fine here (Ubuntu 20.04. Note that you need to have compiled against a version of OpenSSL that supports this algorithm. That probably requires the right OpenSSL version (range) and possibly the right flags.
I don’t know. I did a quick grep for chacha on the source and only found hits in the comments so I suspect crypto_data_encrypt/6 simply passes strings to OpenSSL to select he algorithm. Most likely the openssl command has some option to check which algorithms it supports. Make sure Prolog and openssl bind to the same library though. An old library or header in the wrong place is another common cause for issues like this.
We went from 8.0 to 8.2, which in SWI-Prolog’s versioning is a new release cycle. The project is less suitable for the common major.minor.patch semantics. On the stable release we want to maintain the patch level semantics. On the development cycle things just develop and may break. As is, major releases are landmarks that indicate major changes of functionality. I agree this is all a bit fuzzy