Markus Triska
e8653ffe32
add type check for scalar argument in crypto_curve_scalar_mult/4
...
Suggested by @notoria in #576 . Many thanks!
2020-06-07 18:51:13 +02:00
Markus Triska
5499df418a
use secp256k1 in the example
2020-06-07 11:04:24 +02:00
Markus Triska
b586618411
ENHANCED: Faster Rust-based crypto_curve_scalar_mult/4 using OpenSSL.
2020-06-07 11:04:24 +02:00
Mark Thom
fe0bf6f2ef
Merge pull request #524 from matt2xu/decode_utf8
...
Add decoding of UTF-8 sequences
2020-05-26 13:42:42 -03:00
Markus Triska
b0df981b01
ADDED: halt/1, halting with specified exit code
2020-05-23 19:28:17 +02:00
Mark Thom
888d844ec5
address arity discrepancies in builtins.n and call/N ( #525 )
2020-05-22 23:57:32 -06:00
Matthieu Wipliez
cc9d6587a3
Implementation of UTF-8 bytes to chars
2020-05-22 23:33:12 +02:00
Markus Triska
48c0b0ab3c
ENHANCED: Faster format/3 for binary streams.
...
This speeds up web servers considerably when sending binary files.
2020-05-22 17:30:29 +02:00
Markus Triska
cbbed310c5
ADDED: format/3, writing formatted output to a stream
...
Both binary and text streams are supported.
2020-05-22 17:23:51 +02:00
Markus Triska
1108c99688
document that lists of integers can be specified if encoding(octet) is used
...
This seems to be a good compromise: The API now strongly encourages
lists of characters, which are ideally suited to represent text, and
also allows lists of bytes if the encoding(octet) option is used.
2020-05-21 13:41:57 +02:00
Markus Triska
93da831ef0
correct mode indication for ed25519_verify/4
...
Noted by @notoria in #545 . Many thanks!
2020-05-21 01:27:06 +02:00
Markus Triska
72bf45912e
"PrivateKey" --> "KeyPair"
2020-05-21 00:14:15 +02:00
Markus Triska
5d94276c4f
remove several mentions of list of bytes in predicate descriptions
...
This is to focus more on the intended core representation of text: In
Prolog, text is ideally represented as a list of characters, and this
is what we want to encourage, especially given Scryer's compact
representation for strings.
For the time being, library(crypto) still also supports lists of bytes in
several predicates. This will likely be removed at some point in the
future. Please use lists of characters to make your code future-proof.
2020-05-21 00:07:42 +02:00
Markus Triska
b43f27030e
require PKCS#8 v2 format for better security
...
Notably, this format requires that the public key also be present.
This format is what ed25519_new_keypair/1 generates, and it is
strongly encouraged for higher security.
2020-05-20 23:55:21 +02:00
Markus Triska
2845f55157
ADDED: ed25519_keypair_public_key/2, relating a key pair to its public key
2020-05-20 23:43:28 +02:00
Markus Triska
e254d84710
clarify format of public key
2020-05-20 23:17:42 +02:00
Markus Triska
0ef7b5488d
ADDED: ed25519_new_keypair/1 to dynamically create a new Ed25519 key pair
2020-05-20 23:11:56 +02:00
Markus Triska
2d036c6b25
"codes" --> "bytes"
...
Support for lists of bytes may be dropped from library(crypto). Use
lists of characters to make your code future-proof. Lists of
characters will always be supported due to their compactness,
and because Prolog applications should move towards characters.
2020-05-20 22:32:39 +02:00
Markus Triska
ad3be5c848
ADDED: Public key signatures and signature verification with Ed25519
2020-05-20 22:32:39 +02:00
Markus Triska
21b7348c6a
import member/2 from library(lists)
2020-05-19 20:13:06 +02:00
Mark Thom
ad6fc89a24
Merge pull request #533 from triska/master
...
ADDED: Support for SHA-3 algorithms in crypto_data_hash/3
2020-05-19 14:23:12 -03:00
Markus Triska
0bd9831eec
ADDED: phrase_from_file/3 in library(pio)
...
This allows us to specify type(binary), and read from binary files
with DCGs.
2020-05-19 18:52:18 +02:00
Markus Triska
dec2ef70c7
better error handling in crypto_data_hkdf/4
...
Noted by @notoria in #533 . Many thanks!
2020-05-19 18:22:25 +02:00
Markus Triska
da4d061067
correct option processing in crypto_data_decrypt/6
2020-05-19 17:02:33 +02:00
Markus Triska
9f5322d309
ADDED: Support for BLAKE2 algorithms in crypto_data_hash/3.
2020-05-19 12:44:10 +02:00
Markus Triska
f5c2f6f9e9
ADDED: Support for SHA-3 algorithms in crypto_data_hash/3
2020-05-19 12:10:46 +02:00
Markus Triska
a423eb5323
stronger validation of input lists for cryptographic routines
...
Example:
?- crypto_data_hkdf(Var, 32, Bs, []).
caught: error(instantiation_error,must_be/2)
Reported by @notoria in #527 . Many thanks!
2020-05-18 13:28:52 +02:00
Markus Triska
e9f8b35918
centralize reasoning about encoding
2020-05-18 11:29:35 +02:00
Markus Triska
23034dd4f5
raise instantiation errors for variable encoding
...
Reported by notoria in #527 .
Note that from a declarative perspective, it would indeed be valid to
give answers for both available encodings.
2020-05-18 11:21:38 +02:00
Markus Triska
70ad44adfd
type check for length argument in crypto_data_hkdf/4
...
Reported by @notoria in #527 .
2020-05-18 11:12:59 +02:00
Markus Triska
95ca8a2630
throw instantiation error if the list of options contains a variable ( #523 )
...
Many thanks to @notoria for the test case!
2020-05-18 09:58:09 +02:00
Markus Triska
3855d7ea02
type test for salt in crypto_password_hash/3
2020-05-17 22:01:22 +02:00
Mark Thom
a38fb41e37
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-05-16 14:51:19 -06:00
Mark Thom
204ae377e3
restore old clpz.pl
2020-05-16 14:51:04 -06:00
Markus Triska
862ae26631
Authenticated encryption in library(crypto), new encoding/1 option for hashes ( #515 )
...
* shorten n_newlines//1
* remove unneeded variable
* ADDED: authenticated encryption and decryption with ChaCha20-Poly1305
* ADDED: encoding/1 option for crypto_data_hash/3 and crypto_data_hkdf/4
2020-05-16 11:51:41 -06:00
Mark Thom
9e0208ec71
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-05-15 22:51:24 -06:00
Mark Thom
510530973c
correct mishandled Addr::CharCode case in eq_test ( #505 )
2020-05-15 22:51:18 -06:00
Markus Triska
4e69301562
ADDED: Password-based key derivation (PBKDF2) ( #509 )
...
The new predicates crypto_password_hash/[2,3] let you store
passwords safely, and easily verify passwords later.
2020-05-15 10:49:23 -06:00
Matthieu Wipliez
df06d4b9a2
Work in progress: add char_utf8bytes ( #493 )
...
* Add char_utf8bytes to library
* Improved implementation
* Improve code + add chars predicate
* Update example
* Renamed string_utf8bytes to char_utf8bytes
2020-05-15 10:05:04 -06:00
Mark Thom
b60561c3bb
fix existence_error in atom_chars/2, atom_codes/2 ( #504 , #506 )
2020-05-14 22:33:28 -06:00
Markus Triska
50776748a7
ADDED: HMAC-based key derivation (HKDF) via crypto_data_hkdf/4
...
This is useful to generate keys and initialization vectors
from suitable input keying material, so that future predicates
for symmetric encryption can be used with appropriate parameters.
2020-05-14 20:07:59 +02:00
Markus Triska
4084005ee7
ADDED: Reasoning about elliptic curves in library(crypto).
...
This is useful to establish shared secrets, using ECDH key exchange.
Note that CLP(ℤ) goal expansion is currently disabled due to #445 ,
and this slows down the computations considerably for the time being.
2020-05-13 22:44:27 +02:00
Markus Triska
fd761735d4
ADDED: ripemd160 digest algorithm
...
This is used for example for Bitcoin address generation.
2020-05-13 22:36:40 +02:00
Mark Thom
9cb98bdcdc
Merge pull request #496 from triska/master
...
ADDED: crypto_data_hash/3, computing cryptographically secure digests
2020-05-13 17:32:46 -03:00
notoria
a86019d53b
Enhanced between/3
2020-05-13 21:21:46 +02:00
Markus Triska
8cd7d08573
ADDED: crypto_data_hash/3, computing cryptographically secure digests
2020-05-13 19:23:09 +02:00
Markus Triska
716fde5784
ADDED: crypto_n_random_bytes/2, creating cryptographically secure random bytes
...
The ring crate is used since it will be needed also for future
predicates in library(crypto).
2020-05-13 00:36:27 +02:00
Mark Thom
d1d36f9af0
fix at_end_of_stream/1 ( #479 )
2020-05-10 16:06:15 -06:00
Mark Thom
56efb4ffba
change VarNames to VNNames ( #476 )
2020-05-10 15:54:53 -06:00
Mark Thom
540bc71873
use heap_pstr_iter in AtomChars ( #482 )
2020-05-10 15:46:51 -06:00