module Botan::PK
Public Class Methods
mceies_decrypt(private_key:, ciphertext:, ad:, aead: DEFAULT_AEAD)
click to toggle source
Decrypts with McEliece.
@param private_key [Botan::PK::PrivateKey] the private key @param ciphertext [String] the data to decrypt @param ad [String] the associated data @param aead [String] the (AEAD) cipher+mode @return [String] the decrypted data
# File lib/botan/pk/mceies.rb, line 45 def self.mceies_decrypt(private_key:, ciphertext:, ad:, aead: DEFAULT_AEAD) ct_buf = FFI::MemoryPointer.from_data(ciphertext) ad_buf = FFI::MemoryPointer.from_data(ad) Botan.call_ffi_with_buffer(lambda { |b, bl| LibBotan.botan_mceies_decrypt(private_key.ptr, aead, ct_buf, ct_buf.size, ad_buf, ad.size, b, bl) }) end
mceies_encrypt(public_key:, plaintext:, ad:, aead: DEFAULT_AEAD, rng: Botan::RNG.new)
click to toggle source
Encrypts with McEliece.
@param public_key [Botan::PK::PublicKey] the public key @param plaintext [String] the data to encrypt @param ad [String] the associated data @param aead [String] the (AEAD) cipher+mode @param rng [Botan::RNG] the RNG
to use @return [String] the encrypted data
# File lib/botan/pk/mceies.rb, line 20 def self.mceies_encrypt(public_key:, plaintext:, ad:, aead: DEFAULT_AEAD, rng: Botan::RNG.new) pt_buf = FFI::MemoryPointer.from_data(plaintext) ad_buf = FFI::MemoryPointer.from_data(ad) Botan.call_ffi_with_buffer(lambda { |b, bl| LibBotan.botan_mceies_encrypt(public_key.ptr, rng.ptr, aead, pt_buf, pt_buf.size, ad_buf, ad_buf.size, b, bl) }) end