int PEM_def_callback(char *buf, int num, int w, void *key)
{
    int i, j;
    const char *prompt;
    if (key) {
        i = strlen(key);
        i = (i > num) ? num : i;
        memcpy(buf, key, i);
        return i;
    }
    prompt = EVP_get_pw_prompt();
    if (prompt == NULL)
        prompt = "Enter PEM pass phrase:";
    for (;;) {
        int min_len = w ? MIN_LENGTH : 0;
        i = EVP_read_pw_string_min(buf, min_len, num, prompt, w);
        if (i != 0) {
            PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD);
            memset(buf, 0, (unsigned int)num);
            return -1;
        }
        j = strlen(buf);
        if (min_len && j < min_len) {
            fprintf(stderr,
                    "phrase is too short, needs to be at least %d chars\n",
                    min_len);
        } else
            break;
    }
    return j;
}
['int PEM_def_callback(char *buf, int num, int w, void *key)\n{\n    int i, j;\n    const char *prompt;\n    if (key) {\n        i = strlen(key);\n        i = (i > num) ? num : i;\n        memcpy(buf, key, i);\n        return i;\n    }\n    prompt = EVP_get_pw_prompt();\n    if (prompt == NULL)\n        prompt = "Enter PEM pass phrase:";\n    for (;;) {\n        int min_len = w ? MIN_LENGTH : 0;\n        i = EVP_read_pw_string_min(buf, min_len, num, prompt, w);\n        if (i != 0) {\n            PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD);\n            memset(buf, 0, (unsigned int)num);\n            return -1;\n        }\n        j = strlen(buf);\n        if (min_len && j < min_len) {\n            fprintf(stderr,\n                    "phrase is too short, needs to be at least %d chars\\n",\n                    min_len);\n        } else\n            break;\n    }\n    return j;\n}']