aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/crypto/openssl/utils.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-08-22 19:03:26 +0200
committerMarvin W <git@larma.de>2026-10-23 16:58:30 +0200
commitb0456e13ed35e6ebf684b3a7f4d1cb4b6ec352cc (patch)
tree5ecd70a986a08c1cf9984bdda97a9cc8c05255af /libdino/src/crypto/openssl/utils.vala
parent76a91fca2fc7dd5975e8ff0e6695f27c98539dba (diff)
Move crypto-vala inside libdino
Diffstat (limited to 'libdino/src/crypto/openssl/utils.vala')
-rw-r--r--libdino/src/crypto/openssl/utils.vala19
1 files changed, 19 insertions, 0 deletions
diff --git a/libdino/src/crypto/openssl/utils.vala b/libdino/src/crypto/openssl/utils.vala
new file mode 100644
index 00000000..7a9ed9b6
--- /dev/null
+++ b/libdino/src/crypto/openssl/utils.vala
@@ -0,0 +1,19 @@
+namespace Dino.Crypto {
+
+public static void randomize(uint8[] buffer) {
+ OpenSSL.RAND.bytes(buffer);
+}
+
+internal void openssl_error() throws Error {
+ throw new Crypto.Error.OPENSSL(OpenSSL.ERR.reason_error_string(OpenSSL.ERR.get_error()));
+}
+
+public SymmetricCipherEncryption create_symmetric_cipher_encryption(string algo_name) throws Error {
+ return new SymmetricCipherEncryptionOpenssl(algo_name);
+}
+
+public SymmetricCipherDecryption create_symmetric_cipher_decryption(string algo_name) throws Error {
+ return new SymmetricCipherDecryptionOpenssl(algo_name);
+}
+
+}