aboutsummaryrefslogtreecommitdiff
path: root/crypto-vala/src/openssl.vala
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2023-11-24 20:53:50 +0100
committerMarvin W <git@larma.de>2026-10-23 16:58:30 +0200
commit76a91fca2fc7dd5975e8ff0e6695f27c98539dba (patch)
tree7829340be71fe60ef847247e578c4589571fecc5 /crypto-vala/src/openssl.vala
parentb013d28182ce582f229185c23b6011f566f1f8cc (diff)
Add support for OpenSSL
Uses work by @hrxi in https://github.com/dino/dino/pull/1515 Co-Authored-By: hrxi <hrrrxi@gmail.com>
Diffstat (limited to 'crypto-vala/src/openssl.vala')
-rw-r--r--crypto-vala/src/openssl.vala19
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto-vala/src/openssl.vala b/crypto-vala/src/openssl.vala
new file mode 100644
index 00000000..4a288467
--- /dev/null
+++ b/crypto-vala/src/openssl.vala
@@ -0,0 +1,19 @@
+namespace 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);
+}
+
+}