aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/prosody/util/crypto.d.tl
blob: 866185d0dbec1ade9db663a3a995098d79ada328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local record lib
	record key
		private_pem : function (key) : string
		public_pem : function (key) : string
		get_type : function (key) : string
	end

	type base_evp_sign = function (key, message : string) : string
	type base_evp_verify = function (key, message : string, signature : string) : boolean

	ed25519_sign : base_evp_sign
	ed25519_verify : base_evp_verify

	ecdsa_sha256_sign : base_evp_sign
	ecdsa_sha256_verify : base_evp_verify
	ecdsa_sha384_sign : base_evp_sign
	ecdsa_sha384_verify : base_evp_verify
	ecdsa_sha512_sign : base_evp_sign
	ecdsa_sha512_verify : base_evp_verify

	rsassa_pkcs1_sha256_sign : base_evp_sign
	rsassa_pkcs1_sha256_verify : base_evp_verify
	rsassa_pkcs1_sha384_sign : base_evp_sign
	rsassa_pkcs1_sha384_verify : base_evp_verify
	rsassa_pkcs1_sha512_sign : base_evp_sign
	rsassa_pkcs1_sha512_verify : base_evp_verify

	rsassa_pss_sha256_sign : base_evp_sign
	rsassa_pss_sha256_verify : base_evp_verify
	rsassa_pss_sha384_sign : base_evp_sign
	rsassa_pss_sha384_verify : base_evp_verify
	rsassa_pss_sha512_sign : base_evp_sign
	rsassa_pss_sha512_verify : base_evp_verify

	type Levp_encrypt = function (key : string, iv : string, plaintext : string) : string
	type Levp_decrypt = function (key : string, iv : string, ciphertext : string) : string, string

	aes_128_gcm_encrypt : Levp_encrypt
	aes_128_gcm_decrypt : Levp_decrypt
	aes_256_gcm_encrypt : Levp_encrypt
	aes_256_gcm_decrypt : Levp_decrypt

	aes_256_ctr_encrypt : Levp_encrypt
	aes_256_ctr_decrypt : Levp_decrypt

	generate_ed25519_keypair : function () : key

	import_private_pem : function (string) : key
	import_public_pem : function (string) : key

	parse_ecdsa_signature : function (string, integer) : string, string
	build_ecdsa_signature : function (r : string, s : string) : string

	version : string
	_LIBCRYPTO_VERSION : string
end
return lib