test verify_mic is both directions
This commit is contained in:
		| @@ -63,6 +63,24 @@ do_trans (int sock, gss_ctx_id_t context_hdl) | ||||
|     write_token (sock, input_token); | ||||
|     write_token (sock, output_token); | ||||
|  | ||||
|     gss_release_buffer(&min_stat, output_token); | ||||
|  | ||||
|     /* verify mic */ | ||||
|  | ||||
|     read_token (sock, input_token); | ||||
|     read_token (sock, output_token); | ||||
|  | ||||
|     maj_stat = gss_verify_mic(&min_stat, | ||||
| 			      context_hdl, | ||||
| 			      input_token, | ||||
| 			      output_token, | ||||
| 			      NULL); | ||||
|     if (GSS_ERROR(maj_stat)) | ||||
| 	gss_err (1, min_stat, "gss_verify_mic"); | ||||
|  | ||||
|     gss_release_buffer (&min_stat, input_token); | ||||
|     gss_release_buffer (&min_stat, output_token); | ||||
|  | ||||
|     /* wrap */ | ||||
|  | ||||
|     input_token->length = 7; | ||||
|   | ||||
| @@ -90,6 +90,24 @@ process_it(int sock, | ||||
|     gss_release_buffer (&min_stat, input_token); | ||||
|     gss_release_buffer (&min_stat, output_token); | ||||
|  | ||||
|     /* create mic */ | ||||
|  | ||||
|     input_token->length = 6; | ||||
|     input_token->value  = strdup("hejsan"); | ||||
|  | ||||
|     maj_stat = gss_get_mic(&min_stat, | ||||
| 			   context_hdl, | ||||
| 			   GSS_C_QOP_DEFAULT, | ||||
| 			   input_token, | ||||
| 			   output_token); | ||||
|     if (GSS_ERROR(maj_stat)) | ||||
| 	gss_err (1, min_stat, "gss_get_mic"); | ||||
|  | ||||
|     write_token (sock, input_token); | ||||
|     write_token (sock, output_token); | ||||
|  | ||||
|     gss_release_buffer (&min_stat, output_token); | ||||
|  | ||||
|     /* gss_unwrap */ | ||||
|  | ||||
|     read_token (sock, input_token); | ||||
|   | ||||
| @@ -89,6 +89,7 @@ public class jgssapi_server { | ||||
| 	 */ | ||||
| 	System.out.println("mic test"); | ||||
|  | ||||
| 	System.out.println("  verify mic"); | ||||
|  | ||||
| 	byte[] intoken = getMessage(inStream); | ||||
| 	byte[] outtoken = getMessage(inStream); | ||||
| @@ -97,6 +98,14 @@ public class jgssapi_server { | ||||
| 	context.verifyMIC(outtoken, 0, outtoken.length,  | ||||
| 			  intoken, 0, intoken.length, new MessageProp(0, false)); | ||||
|  | ||||
| 	System.out.println("  create mic"); | ||||
|  | ||||
| 	bytes = new byte[] { 0x66, 0x6f, 0x6f }; | ||||
|  | ||||
| 	outtoken = context.getMIC(bytes, 0, bytes.length, new MessageProp(0, false)); | ||||
| 	putMessage(outStream, bytes); | ||||
| 	putMessage(outStream, outtoken); | ||||
|  | ||||
| 	/* | ||||
| 	 * wrap int | ||||
| 	 */ | ||||
| @@ -131,10 +140,8 @@ public class jgssapi_server { | ||||
| 	putMessage(outStream, outtoken); | ||||
| 	outtoken = getMessage(inStream); | ||||
|  | ||||
|  | ||||
| 	context.dispose(); | ||||
|  | ||||
|  | ||||
| 	System.exit(0); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Love Hornquist Astrand
					Love Hornquist Astrand