Cryptography Reference
In-Depth Information
}
parse_private_key( &private_key, buffer, buffer_length );
free( buffer );
handshake_signature_len = ( unsigned short ) rsa_sign( handshake_hash,
MD5_BYTE_SIZE + SHA1_BYTE_SIZE, &handshake_signature,
&private_key );
certificate_verify_message_len = handshake_signature_len +
sizeof( unsigned short );
certificate_verify_message = ( unsigned char * )
malloc( certificate_verify_message_len );
// copying this “backwards” so that I can use the signature len
// as a numeric input but then htons it to send on.
memcpy( ( void * ) ( certificate_verify_message + 2 ),
( void * ) handshake_signature, handshake_signature_len );
handshake_signature_len = htons( handshake_signature_len );
memcpy( ( void * ) certificate_verify_message,
( void * ) &handshake_signature_len, sizeof( unsigned short ) );
send_handshake_message( connection, certificate_verify,
certificate_verify_message, certificate_verify_message_len, parameters );
free( certificate_verify_message );
free( handshake_signature );
return 1;
}
int tls_connect( int connection,
TLSParameters *parameters )
{
if ( !( send_client_key_exchange( connection, parameters ) ) )
{
perror( “Unable to send client key exchange” );
return 3;
}
// Certificate verify comes after key exchange
if ( parameters->got_certificate_request )
{
if ( !send_certificate_verify( connection, parameters ) )
{
perror( “Unable to send certificate verify message” );
return 3;
}
}
Search WWH ::




Custom Search