int str2fmt(char *s)
	{
	if (s == NULL)
		return FORMAT_UNDEF;
	if 	((*s == 'D') || (*s == 'd'))
		return(FORMAT_ASN1);
	else if ((*s == 'T') || (*s == 't'))
		return(FORMAT_TEXT);
  	else if ((*s == 'N') || (*s == 'n'))
  		return(FORMAT_NETSCAPE);
  	else if ((*s == 'S') || (*s == 's'))
  		return(FORMAT_SMIME);
 	else if ((*s == 'M') || (*s == 'm'))
 		return(FORMAT_MSBLOB);
	else if ((*s == '1')
		|| (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0)
		|| (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0))
		return(FORMAT_PKCS12);
	else if ((*s == 'E') || (*s == 'e'))
		return(FORMAT_ENGINE);
	else if ((*s == 'P') || (*s == 'p'))
 		{
 		if (s[1] == 'V' || s[1] == 'v')
 			return FORMAT_PVK;
 		else
  			return(FORMAT_PEM);
 		}
	else
		return(FORMAT_UNDEF);
	}
int str2fmt(char *s)
	{
	if (s == NULL)
		return FORMAT_UNDEF;
	if 	((*s == 'D') || (*s == 'd'))
		return(FORMAT_ASN1);
	else if ((*s == 'T') || (*s == 't'))
		return(FORMAT_TEXT);
  	else if ((*s == 'N') || (*s == 'n'))
  		return(FORMAT_NETSCAPE);
  	else if ((*s == 'S') || (*s == 's'))
  		return(FORMAT_SMIME);
 	else if ((*s == 'M') || (*s == 'm'))
 		return(FORMAT_MSBLOB);
	else if ((*s == '1')
		|| (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0)
		|| (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0))
		return(FORMAT_PKCS12);
	else if ((*s == 'E') || (*s == 'e'))
		return(FORMAT_ENGINE);
	else if ((*s == 'P') || (*s == 'p'))
 		{
 		if (s[1] == 'V' || s[1] == 'v')
 			return FORMAT_PVK;
 		else
  			return(FORMAT_PEM);
 		}
	else
		return(FORMAT_UNDEF);
	}