/* Add RSA-OAES-SHA1 padding */
i_err = AddOaepPadding( p_this,
/* Add RSA-OAES-SHA1 padding */
i_err = AddOaepPadding( p_this,
/* Read public key */
i_gcrypt_err = gcry_mpi_scan( &mpi_pubkey, GCRYMPI_FMT_USG,
ps_raop_rsa_pubkey,
sizeof( ps_raop_rsa_pubkey ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Read public key */
i_gcrypt_err = gcry_mpi_scan( &mpi_pubkey, GCRYMPI_FMT_USG,
ps_raop_rsa_pubkey,
sizeof( ps_raop_rsa_pubkey ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Read exponent */
i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_USG, ps_raop_rsa_exp,
sizeof( ps_raop_rsa_exp ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Read exponent */
i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_USG, ps_raop_rsa_exp,
sizeof( ps_raop_rsa_exp ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* If the input data starts with a set bit (0x80), gcrypt thinks it's a
* signed integer and complains. Prefixing it with a zero byte (\0)
/* If the input data starts with a set bit (0x80), gcrypt thinks it's a
* signed integer and complains. Prefixing it with a zero byte (\0)
ps_padded_key, sizeof( ps_padded_key ),
NULL);
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
ps_padded_key, sizeof( ps_padded_key ),
NULL);
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Build S-expression with RSA parameters */
i_gcrypt_err = gcry_sexp_build( &sexp_rsa_params, NULL,
"(public-key(rsa(n %m)(e %m)))",
mpi_pubkey, mpi_exp );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Build S-expression with RSA parameters */
i_gcrypt_err = gcry_sexp_build( &sexp_rsa_params, NULL,
"(public-key(rsa(n %m)(e %m)))",
mpi_pubkey, mpi_exp );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Build S-expression for data */
i_gcrypt_err = gcry_sexp_build( &sexp_input, NULL, "(data(value %m))",
mpi_input );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Build S-expression for data */
i_gcrypt_err = gcry_sexp_build( &sexp_input, NULL, "(data(value %m))",
mpi_input );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Encrypt data */
i_gcrypt_err = gcry_pk_encrypt( &sexp_encrypted, sexp_input,
sexp_rsa_params );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Encrypt data */
i_gcrypt_err = gcry_pk_encrypt( &sexp_encrypted, sexp_input,
sexp_rsa_params );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
/* Extract encrypted data */
sexp_token_a = gcry_sexp_find_token( sexp_encrypted, "a", 0 );
if ( !sexp_token_a )
{
msg_Err( p_this , "Token 'a' not found in result S-expression" );
/* Extract encrypted data */
sexp_token_a = gcry_sexp_find_token( sexp_encrypted, "a", 0 );
if ( !sexp_token_a )
{
msg_Err( p_this , "Token 'a' not found in result S-expression" );
p_sys->psz_last_status_line = net_Gets( p_this, p_sys->i_control_fd,
NULL );
if ( !p_sys->psz_last_status_line )
p_sys->psz_last_status_line = net_Gets( p_this, p_sys->i_control_fd,
NULL );
if ( !p_sys->psz_last_status_line )
{
msg_Err( p_this, "Unknown protocol (%s)",
p_sys->psz_last_status_line );
{
msg_Err( p_this, "Unknown protocol (%s)",
p_sys->psz_last_status_line );
{
msg_Err( p_this, "Request failed (%s)",
p_sys->psz_last_status_line );
{
msg_Err( p_this, "Request failed (%s)",
p_sys->psz_last_status_line );