Public Attributes | List of all members
alts_crypter_vtable Struct Reference

#include <alts_crypter.h>

Public Attributes

void(* destruct )(alts_crypter *crypter)
 
size_t(* num_overhead_bytes )(const alts_crypter *crypter)
 
grpc_status_code(* process_in_place )(alts_crypter *crypter, unsigned char *data, size_t data_allocated_size, size_t data_size, size_t *output_size, char **error_details)
 

Detailed Description

A typical usage of the interface would be

// Perform a seal operation. We assume the gsec_aead_crypter instance - // client_aead_crypter is created beforehand with a 16-byte key and 12-byte // nonce length.

alts_crypter* client = nullptr; char* client_error_in_creation = nullptr; unsigned char* data = nullptr; grpc_status_code client_status = alts_seal_crypter_create(client_aead_crypter, 1, 5, &client, &client_error_in_creation); if (client_status == GRPC_STATUS_OK) { size_t data_size = 100; size_t num_overhead_bytes = alts_crypter_num_overhead_bytes(client); size_t data_allocated_size = data_size + num_overhead_bytes; data = gpr_malloc(data_allocated_size); char* client_error_in_seal = nullptr; // Client performs a seal operation. client_status = alts_crypter_process_in_place(client, data, data_allocated_size, &data_size, &client_error_in_seal); if (client_status != GRPC_STATUS_OK) { fprintf(stderr, "seal operation failed with error code:" "%d, message: %s\n", client_status, client_error_in_seal); } gpr_free(client_error_in_seal); } else { fprintf(stderr, "alts_crypter instance creation failed with error" "code: %d, message: %s\n", client_status, client_error_in_creation); }

...

gpr_free(client_error_in_creation); alts_crypter_destroy(client);

...

// Perform an unseal operation. We assume the gsec_aead_crypter instance - // server_aead_crypter is created beforehand with a 16-byte key and 12-byte // nonce length. The key used in the creation of gsec_aead_crypter instances // at server and client sides should be identical.

alts_crypter* server = nullptr; char* server_error_in_creation = nullptr; grpc_status_code server_status = alts_unseal_crypter_create(server_aead_crypter, 0, 5, &server, &server_error_in_creation); if (server_status == GRPC_STATUS_OK) { size_t num_overhead_bytes = alts_crypter_num_overhead_bytes(server); size_t data_size = 100 + num_overhead_bytes; size_t data_allocated_size = data_size; char* server_error_in_unseal = nullptr; // Server performs an unseal operation. server_status = alts_crypter_process_in_place(server, data, data_allocated_size, &data_size, &server_error_in_unseal); if (server_status != GRPC_STATUS_OK) { fprintf(stderr, "unseal operation failed with error code:" "%d, message: %s\n", server_status, server_error_in_unseal); } gpr_free(server_error_in_unseal); } else { fprintf(stderr, "alts_crypter instance creation failed with error" "code: %d, message: %s\n", server_status, server_error_in_creation); }

...

gpr_free(data); gpr_free(server_error_in_creation); alts_crypter_destroy(server);

...

Definition at line 124 of file alts_crypter.h.

Member Data Documentation

◆ destruct

void(* alts_crypter_vtable::destruct) (alts_crypter *crypter)

Definition at line 131 of file alts_crypter.h.

◆ num_overhead_bytes

size_t(* alts_crypter_vtable::num_overhead_bytes) (const alts_crypter *crypter)

Definition at line 125 of file alts_crypter.h.

◆ process_in_place

grpc_status_code(* alts_crypter_vtable::process_in_place) (alts_crypter *crypter, unsigned char *data, size_t data_allocated_size, size_t data_size, size_t *output_size, char **error_details)

Definition at line 126 of file alts_crypter.h.


The documentation for this struct was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:39