Exemplo n.º 1
0
int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify)
	{
	char buff[BUFSIZ];
	int ret;

	ret=UI_UTIL_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
	OPENSSL_cleanse(buff,BUFSIZ);
	return(ret);
	}
Exemplo n.º 2
0
int DES_read_password(DES_cblock *key, const char *prompt, int verify)
	{
	int ok;
	char buf[BUFSIZ],buff[BUFSIZ];

	if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
		DES_string_to_key(buf,key);
	OPENSSL_cleanse(buf,BUFSIZ);
	OPENSSL_cleanse(buff,BUFSIZ);
	return(ok);
	}
Exemplo n.º 3
0
int main(void)
{
	char buffer1[64], buffer2[64];
	UI_METHOD *ui_method;
	UI *ui;

	printf("Testing UI_UTIL_read_pw:\n");

	if (UI_UTIL_read_pw(&buffer1[0], &buffer2[0], sizeof(buffer1) - 1, "Prompt", 1) == 0)
		printf("Password: \"%s\"\n", &buffer1[0]);
	else
		printf("Error getting password\n");

	printf("Testing UI with default UI method:\n");

	if((ui = UI_new()) != NULL)
	{
		TestUI(ui);
		UI_free(ui);
	}
	else
		printf("Couldn't setup method\n");

	printf("Testing UI with UI method with wrappers:\n");

	if((ui_method = UI_create_method((char *)"Test method")) != NULL)
	{
		if((ui = UI_new_method(ui_method)) != NULL)
		{
			UI_method_set_opener(ui_method, ui_open);
			UI_method_set_reader(ui_method, ui_read);
			UI_method_set_writer(ui_method, ui_write);
			UI_method_set_closer(ui_method, ui_close);

			TestUI(ui);
			UI_free(ui);
		}
		else
			printf("Couldn't setup method\n");

		UI_destroy_method(ui_method);
	}
	else
		printf("Couldn't create method\n");

	return(0);
}
Exemplo n.º 4
0
int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt,
                          int verify)
{
    return UI_UTIL_read_pw(buf, buff, size, prompt, verify);
}