decode_run("enc_data","","30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_enc_data,ktest_equal_enc_data);
}
+ /****************************************************************/
+ /* decode_sam_challenge */
+ {
+ setup(krb5_sam_challenge,"krb5_sam_challenge",ktest_make_sample_sam_challenge);
+ decode_run("sam_challenge","","30 78 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A3 02 04 00 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A7 02 04 00 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_sam_challenge,ktest_equal_sam_challenge);
+ }
+
+ /****************************************************************/
+ /* decode_sam_response */
+ {
+ setup(krb5_sam_response,"krb5_sam_response",ktest_make_sample_sam_response);
+ decode_run("sam_response","","30 6A A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0C 04 0A 74 72 61 63 6B 20 64 61 74 61 A3 14 30 12 A0 03 02 01 01 A1 04 02 02 07 96 A2 05 04 03 6B 65 79 A4 1C 30 1A A0 03 02 01 01 A1 04 02 02 0D 36 A2 0D 04 0B 6E 6F 6E 63 65 20 6F 72 20 74 73 A5 05 02 03 54 32 10 A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_sam_response,ktest_equal_sam_response);
+ }
+
exit(error_count);
}
setup(enc_data,krb5_enc_data,"enc_data",ktest_make_sample_enc_data);
encode_run(enc_data,krb5_enc_data,"enc_data","",encode_krb5_enc_data);
}
+ /****************************************************************/
+ /* encode_krb5_sam_challenge */
+ {
+ krb5_sam_challenge sam_ch;
+ setup(sam_ch,krb5_sam_challenge,"sam_challenge",
+ ktest_make_sample_sam_challenge);
+ encode_run(sam_ch,krb5_sam_challenge,"sam_challenge","",
+ encode_krb5_sam_challenge);
+ }
+ /****************************************************************/
+ /* encode_krb5_sam_response */
+ {
+ krb5_sam_response sam_ch;
+ setup(sam_ch,krb5_sam_response,"sam_response",
+ ktest_make_sample_sam_response);
+ encode_run(sam_ch,krb5_sam_response,"sam_response","",
+ encode_krb5_sam_response);
+ }
+#if 0
+ /****************************************************************/
+ /* encode_krb5_sam_key */
+ {
+ krb5_sam_key sam_ch;
+ setup(sam_ch,krb5_sam_key,"sam_key",
+ ktest_make_sample_sam_key);
+ encode_run(sam_ch,krb5_sam_key,"sam_key","",
+ encode_krb5_sam_key);
+ }
+ /****************************************************************/
+ /* encode_krb5_enc_sam_response_enc */
+ {
+ krb5_enc_sam_response_enc sam_ch;
+ setup(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc",
+ ktest_make_sample_enc_sam_response_enc);
+ encode_run(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc","",
+ encode_krb5_enc_sam_response_enc);
+ }
+ /****************************************************************/
+ /* encode_krb5_predicted_sam_response */
+ {
+ krb5_predicted_sam_response sam_ch;
+ setup(sam_ch,krb5_predicted_sam_response,"predicted_sam_response",
+ ktest_make_sample_predicted_sam_response);
+ encode_run(sam_ch,krb5_predicted_sam_response,"predicted_sam_response","",
+ encode_krb5_predicted_sam_response);
+ }
+#endif
exit(error_count);
}
return 0;
}
+krb5_error_code ktest_make_sample_sam_challenge(p)
+ krb5_sam_challenge * p;
+{
+ krb5_error_code retval;
+
+ p->magic = KV5M_SAM_CHALLENGE;
+ p->sam_type = 42; /* information */
+ p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */
+ p->sam_type_name.data = "type name";
+ p->sam_type_name.length = strlen(p->sam_type_name.data);
+ p->sam_track_id.data = 0;
+ p->sam_track_id.length = 0;
+ p->sam_challenge_label.data = "challenge label";
+ p->sam_challenge_label.length = strlen(p->sam_challenge_label.data);
+ p->sam_challenge.data = "challenge ipse";
+ p->sam_challenge.length = strlen(p->sam_challenge.data);
+ p->sam_response_prompt.data = "response_prompt ipse";
+ p->sam_response_prompt.length = strlen(p->sam_response_prompt.data);
+ p->sam_pk_for_sad.data = 0;
+ p->sam_pk_for_sad.length = 0;
+ p->sam_nonce = 0x543210;
+ retval = ktest_make_sample_checksum(&p->sam_cksum);
+ if(retval) return retval;
+
+ return 0;
+}
+
+krb5_error_code ktest_make_sample_sam_response(p)
+ krb5_sam_response * p;
+{
+ krb5_error_code retval;
+
+ p->magic = KV5M_SAM_RESPONSE;
+ p->sam_type = 42; /* information */
+ p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */
+ p->sam_track_id.data = "track data";
+ p->sam_track_id.length = strlen(p->sam_track_id.data);
+ p->sam_enc_key.ciphertext.data = "key";
+ p->sam_enc_key.ciphertext.length = strlen(p->sam_enc_key.ciphertext.data);
+ p->sam_enc_key.enctype = ENCTYPE_DES_CBC_CRC;
+ p->sam_enc_key.kvno = 1942;
+ p->sam_enc_nonce_or_ts.ciphertext.data = "nonce or ts";
+ p->sam_enc_nonce_or_ts.ciphertext.length =
+ strlen(p->sam_enc_nonce_or_ts.ciphertext.data);
+ p->sam_enc_nonce_or_ts.enctype = ENCTYPE_DES_CBC_CRC;
+ p->sam_enc_nonce_or_ts.kvno = 3382;
+ p->sam_nonce = 0x543210;
+ p->sam_patimestamp = SAMPLE_TIME;
+
+ return 0;
+}
+
+
+
+
+
/****************************************************************/
/* destructors */
return p;
}
+#define equal_str(f) struct_equal(f,ktest_equal_data)
+
+int ktest_equal_sam_challenge(ref, var)
+ krb5_sam_challenge *ref;
+ krb5_sam_challenge *var;
+{
+ int p=TRUE;
+ if(ref==var) return TRUE;
+ else if(ref == NULL || var == NULL) return FALSE;
+ p=p&&scalar_equal(sam_type);
+ p=p&&scalar_equal(sam_flags);
+ p=p&&scalar_equal(sam_nonce);
+ p=p&&ktest_equal_checksum(&ref->sam_cksum,&var->sam_cksum);
+ p=p&&equal_str(sam_track_id);
+ p=p&&equal_str(sam_challenge_label);
+ p=p&&equal_str(sam_challenge);
+ p=p&&equal_str(sam_response_prompt);
+ p=p&&equal_str(sam_pk_for_sad);
+ return p;
+}
+
+int ktest_equal_sam_response(ref, var)
+ krb5_sam_response *ref;
+ krb5_sam_response *var;
+{
+ int p=TRUE;
+ if(ref==var) return TRUE;
+ else if(ref == NULL || var == NULL) return FALSE;
+ p=p&&scalar_equal(sam_type);
+ p=p&&scalar_equal(sam_flags);
+ p=p&&equal_str(sam_track_id);
+ p=p&&struct_equal(sam_enc_key,ktest_equal_enc_data);
+ p=p&&struct_equal(sam_enc_nonce_or_ts,ktest_equal_enc_data);
+ p=p&&scalar_equal(sam_nonce);
+ p=p&&scalar_equal(sam_patimestamp);
+ return p;
+}
+
/**** arrays ****************************************************************/
int ktest_equal_array_of_data(length, ref, var)
encode_krb5_pa_enc_ts: 30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40
encode_krb5_pa_enc_ts (no usec): 30 13 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A
encode_krb5_enc_data: 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65
+encode_krb5_sam_challenge: 30 78 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A3 02 04 00 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A7 02 04 00 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34
+encode_krb5_sam_response: 30 6A A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0C 04 0A 74 72 61 63 6B 20 64 61 74 61 A3 14 30 12 A0 03 02 01 01 A1 04 02 02 07 96 A2 05 04 03 6B 65 79 A4 1C 30 1A A0 03 02 01 01 A1 04 02 02 0D 36 A2 0D 04 0B 6E 6F 6E 63 65 20 6F 72 20 74 73 A5 05 02 03 54 32 10 A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A
20 74 65 73 74 20 6d 65 test me
73 73 61 67 65 ssage
+encode_krb5_sam_challenge:
+
+[Sequence/Sequence Of]
+. [0] [Integer] <1>
+ 2a *
+. [1] [Bit String] <5>
+ 00 80 00 00 00 .....
+. [2] [Octet String] <9>
+ 74 79 70 65 20 6e 61 6d type nam
+ 65 e
+. [3] [Octet String] <0>
+. [4] [Octet String] <15>
+ 63 68 61 6c 6c 65 6e 67 challeng
+ 65 20 6c 61 62 65 6c e label
+. [5] [Octet String] <14>
+ 63 68 61 6c 6c 65 6e 67 challeng
+ 65 20 69 70 73 65 e ipse
+. [6] [Octet String] <20>
+ 72 65 73 70 6f 6e 73 65 response
+ 5f 70 72 6f 6d 70 74 20 _prompt
+ 69 70 73 65 ipse
+. [7] [Octet String] <0>
+. [8] [Integer] <3>
+ 54 32 10 T2.
+. [9] [Sequence/Sequence Of]
+. . [0] [Integer] <1>
+ 01 .
+. . [1] [Octet String] <4>
+ 31 32 33 34 1234
+
+encode_krb5_sam_response:
+
+[Sequence/Sequence Of]
+. [0] [Integer] <1>
+ 2a *
+. [1] [Bit String] <5>
+ 00 80 00 00 00 .....
+. [2] [Octet String] <10>
+ 74 72 61 63 6b 20 64 61 track da
+ 74 61 ta
+. [3] [Sequence/Sequence Of]
+. . [0] [Integer] <1>
+ 01 .
+. . [1] [Integer] <2>
+ 07 96 ..
+. . [2] [Octet String] <3>
+ 6b 65 79 key
+. [4] [Sequence/Sequence Of]
+. . [0] [Integer] <1>
+ 01 .
+. . [1] [Integer] <2>
+ 0d 36 .6
+. . [2] [Octet String] <11>
+ 6e 6f 6e 63 65 20 6f 72 nonce or
+ 20 74 73 ts
+. [5] [Integer] <3>
+ 54 32 10 T2.
+. [6] [Generalized Time] <15>
+ 31 39 39 34 30 36 31 30 19940610
+ 30 36 30 33 31 37 5a 060317Z
+