Lines Matching refs:key
106 static int write_public_key( mbedtls_pk_context *key, const char *output_file ) in write_public_key() argument
119 if( ( ret = mbedtls_pk_write_pubkey_pem( key, output_buf, 16000 ) ) != 0 ) in write_public_key()
127 if( ( ret = mbedtls_pk_write_pubkey_der( key, output_buf, 16000 ) ) < 0 ) in write_public_key()
148 static int write_private_key( mbedtls_pk_context *key, const char *output_file ) in write_private_key() argument
161 if( ( ret = mbedtls_pk_write_key_pem( key, output_buf, 16000 ) ) != 0 ) in write_private_key()
169 if( ( ret = mbedtls_pk_write_key_der( key, output_buf, 16000 ) ) < 0 ) in write_private_key()
193 mbedtls_pk_context key; in main() local
201 mbedtls_pk_init( &key ); in main()
283 ret = mbedtls_pk_parse_keyfile( &key, opt.filename, NULL ); in main()
300 if( mbedtls_pk_get_type( &key ) == MBEDTLS_PK_RSA ) in main()
302 mbedtls_rsa_context *rsa = mbedtls_pk_rsa( key ); in main()
315 if( mbedtls_pk_get_type( &key ) == MBEDTLS_PK_ECKEY ) in main()
317 mbedtls_ecp_keypair *ecp = mbedtls_pk_ec( key ); in main()
336 ret = mbedtls_pk_parse_public_keyfile( &key, opt.filename ); in main()
353 if( mbedtls_pk_get_type( &key ) == MBEDTLS_PK_RSA ) in main()
355 mbedtls_rsa_context *rsa = mbedtls_pk_rsa( key ); in main()
362 if( mbedtls_pk_get_type( &key ) == MBEDTLS_PK_ECKEY ) in main()
364 mbedtls_ecp_keypair *ecp = mbedtls_pk_ec( key ); in main()
378 write_public_key( &key, opt.output_file ); in main()
382 write_private_key( &key, opt.output_file ); in main()
397 mbedtls_pk_free( &key ); in main()