47 const char *token =
"nonce=4711, foo=bar, algorithm=md5-sess";
49 printf (
"challenge `%s': ", token);
53 printf (
"nonce `%s': %s", c.
nonce,
54 strcmp (
"4711", c.
nonce) == 0 ?
"PASS" :
"FAILURE");
59 printf (
"printed `%s' PASS\n", tmp);
66 "qop=\"auth, auth-conf\", nonce=42, algorithm=md5-sess";
68 printf (
"challenge `%s': ", token);
77 const char *token =
"cipher=\"des\", nonce=42, algorithm=md5-sess";
79 printf (
"challenge `%s': ", token);
88 const char *token =
"qop=\"auth, auth-conf\", nonce=42, "
89 "algorithm=md5-sess, cipher=\"des\"";
91 printf (
"challenge `%s': ", token);
95 printf (
"qop %02x ciphers %02x: %s\n",
97 (c.
qops == 5 && c.
ciphers == 1) ?
"PASS" :
"FAILURE");
101 printf (
"printed `%s' PASS\n", tmp);
107 const char *token =
"bar=foo, foo=bar";
109 printf (
"challenge `%s': ", token);
117 const char *token =
"realm=foo, realm=bar, nonce=42, algorithm=md5-sess";
119 printf (
"challenge `%s': ", token);
125 printf (
"realms `%s', `%s': PASS\n", c.
realms[0], c.
realms[1]);
129 printf (
"printed `%s' PASS\n", tmp);
137 const char *token =
"bar=foo, foo=bar";
139 printf (
"response `%s': ", token);
148 const char *token =
"username=jas, nonce=42, cnonce=4711, nc=00000001, "
149 "digest-uri=foo, response=01234567890123456789012345678901";
151 printf (
"response `%s': ", token);
155 printf (
"username `%s', nonce `%s', cnonce `%s',"
156 " nc %08lx, digest-uri `%s', response `%s': PASS\n",
161 printf (
"printed `%s' PASS\n", tmp);
169 const char *token =
"rspauth=\"6a204da26b9888ee40bb3052ff056a67\"";
171 printf (
"finish `%s': ", token);
175 printf (
"`%s'? %s\n", f.
rspauth,
176 strcmp (
"6a204da26b9888ee40bb3052ff056a67", f.
rspauth) == 0
182 const char *token =
"bar=foo, foo=bar";
184 printf (
"finish `%s': ", token);
188 printf (
"invalid? PASS\n");
195 printf (
"gc_init error %d\n",
rc);
199 memset (buf16,
'Q', 16);
203 1, 0, NULL, NULL, NULL, NULL);
207 if (strcmp (buf32,
"6a204da26b9888ee40bb3052ff056a67") != 0)
209 printf (
"digest: `%s': PASS\n", buf32);
213 NULL, NULL, NULL, NULL);
217 if (strcmp (buf32,
"6c1f58bfa46e9c225b93745c84204efd") != 0)
219 printf (
"digest: `%s': PASS\n", buf32);
void digest_md5_free_finish(digest_md5_finish *f)
void digest_md5_free_response(digest_md5_response *r)
void digest_md5_free_challenge(digest_md5_challenge *c)
int digest_md5_parse_challenge(const char *challenge, size_t len, digest_md5_challenge *out)
int digest_md5_parse_response(const char *response, size_t len, digest_md5_response *out)
int digest_md5_parse_finish(const char *finish, size_t len, digest_md5_finish *out)
char * digest_md5_print_challenge(digest_md5_challenge *c)
char * digest_md5_print_response(digest_md5_response *r)
int digest_md5_hmac(char *output, char secret[MD5LEN], const char *nonce, unsigned long nc, const char *cnonce, digest_md5_qop qop, const char *authzid, const char *digesturi, int rspauth, digest_md5_cipher cipher, char *kic, char *kis, char *kcc, char *kcs)
char rspauth[DIGEST_MD5_RESPONSE_LENGTH+1]
char response[DIGEST_MD5_RESPONSE_LENGTH+1]