.TH LC_CTX_SET_SYM_KEY 3 2023-07-31 "LIBRECAST" "Librecast Programmer's Manual" .SH NAME lc_ctx_set_sym_key, lc_ctx_set_pub_key, lc_channel_set_sym_key, lc_channel_set_pub_key - set Librecast channel encoding keys .SH LIBRARY Librecast library .RI ( liblibrecast ", " \-llibrecast ) .SH SYNOPSIS .nf .B #include .PP .BI "int lc_ctx_set_sym_key(lc_ctx_t " *ctx ", unsigned char " *key ", size_t " len ");" .BI "int lc_ctx_set_pub_key(lc_ctx_t " *ctx ", unsigned char " *key ", size_t " len ");" .BI "int lc_channel_set_sym_key(lc_channel_t " *chan ", unsigned char " *key ", size_t " len ");" .BI "int lc_channel_set_pub_key(lc_channel_t " *chan ", unsigned char " *key ", size_t " len" );" .fi .PP Compile and link with \fI\-llibrecast\fP. .SH DESCRIPTION These functions set encryption keys for a Librecast context .IR ctx or channel .IR chan . .PP The .BR lc_ctx_set_sym_key () function sets a symmetric .IR key of length .IR len on a Librecast context. This key will be used by default by any channels subsequently created using the context. Any existing channels will retain their existing key. .PP The .BR lc_ctx_set_pub_key () function sets a public .IR key of length .IR len on a Librecast context. This key will be used by default by any channels subsequently created using the context. Any existing channels will retain their existing key. .PP The .BR lc_channel_set_sym_key () function sets a symmetric .IR key of length .IR len on a Librecast channel. .PP The .BR lc_channel_set_pub_key () function sets a public .IR key of length .IR len on a Librecast channel. .PP .SH RETURN VALUE These functions return zero on success. On error, -1 is returned and .BR errno is set to indicate the error. .SH ERRORS .TP .BR EINVAL Invalid argument. .PP .SH SEE ALSO .BR lc_ctx_coding_set (3), .BR lc_channel_new (3), .BR lc_channel_close (3), .BR lc_channel_coding_set (3), .BR lc_channel_send (3), .BR lc_ctx_new (3), .BR lc_socket_setopt (3), .BR lc_socket_recv (3)