openssl RSA 질문입니다.
openssl RSA질문입니다.
openssl Documents pem에 있는 내용인데요
전개인키를 비밀번호를 설정하고 다른비밀번호로 바꾸고 싶은데요
설정까지는 되는데 다른걸로 바꾸는게 어렵네요
밑에 내용중 pass phrase callback은 무슨내용인가요?
잘못된비밀번호를 넣으면 hello로 바꿔준다는건지...아니면 다른걸로 바꾼다는건지..이해가 안되서요
아시는분 답변좀...
Read a private key from a BIO using the pass phrase ``hello'':
key = PEM_read_bio_PrivateKey(bp, NULL, 0, "hello");
if (key == NULL)
{
/* Error */
}
Read a private key from a BIO using a pass phrase callback:
key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, "My Private Key");
if (key == NULL)
{
/* Error */
}
Skeleton pass phrase callback:
int pass_cb(char *buf, int size, int rwflag, void *u);
{
int len;
char *tmp;
/* We'd probably do something else if 'rwflag' is 1 */
printf("Enter pass phrase for \"%s\"\n", u);
/* get pass phrase, length 'len' into 'tmp' */
tmp = "hello";
len = strlen(tmp);
if (len <= 0) return 0;
/* if too long, truncate */
if (len > size) len = size;
memcpy(buf, tmp, len);
return len;
}
댓글 달기