| 795 | } |
| 796 | |
| 797 | public static int MiscFunctionTests() |
| 798 | { |
| 799 | long maj_status = 0; |
| 800 | long[] min_status = {0}; |
| 801 | gss_cred_id_t_desc cred_handle = GSS_C_NO_CREDENTIAL; |
| 802 | /* kerberos v5 */ |
| 803 | gss_OID_desc mech_type = new gss_OID_desc("1.2.840.113554.1.2.2"); |
| 804 | gss_name_t_desc name = new gss_name_t_desc(); |
| 805 | long[] init_lifetime = {0}; |
| 806 | long[] accept_lifetime = {0}; |
| 807 | int[] cred_usage = {0}; |
| 808 | |
| 809 | System.out.println("------------------- MISC TESTS ------------------"); |
| 810 | |
| 811 | /* |
| 812 | * FUNCTION: gss_inquire_cred_by_mech |
| 813 | * Get info about default cred for default security mech. |
| 814 | */ |
| 815 | maj_status = gsswrapper.gss_inquire_cred_by_mech(min_status, |
| 816 | cred_handle, mech_type, name, init_lifetime, |
| 817 | accept_lifetime, cred_usage); |
| 818 | if (maj_status != GSS_S_COMPLETE) { |
| 819 | Util.displayError("inquiring credential info from mech", |
| 820 | min_status, maj_status); |
| 821 | return -1; |
| 822 | } else { |
| 823 | System.out.println("Credential Principal Name: " |
| 824 | + name.getExternal_name().getValue()); |
| 825 | System.out.println("Credential Valid for Initiating Contexts for " |
| 826 | + init_lifetime[0] + " seconds"); |
| 827 | System.out.println("Credential Valid for Accepting Contexts for " |
| 828 | + accept_lifetime[0] + " seconds"); |
| 829 | System.out.println("Credential Usage: " + cred_usage[0]); |
| 830 | } |
| 831 | |
| 832 | |
| 833 | /* FUNCTION: gss_pseudo_random */ |
| 834 | gss_buffer_desc prf_out = new gss_buffer_desc(); |
| 835 | gss_buffer_desc prf_in = new gss_buffer_desc("gss prf test"); |
| 836 | maj_status = gsswrapper.gss_pseudo_random(min_status, |
| 837 | context, 0, prf_in, 19, prf_out); |
| 838 | if (maj_status != GSS_S_COMPLETE) { |
| 839 | Util.displayError("testing gss_pseudo_random function", |
| 840 | min_status, maj_status); |
| 841 | return -1; |
| 842 | } |
| 843 | |
| 844 | gsswrapper.gss_release_buffer(min_status, prf_out); |
| 845 | gsswrapper.gss_release_buffer(min_status, prf_in); |
| 846 | |
| 847 | /* FUNCTION: gss_indicate_mechs_by_attrs */ |
| 848 | gss_OID_set_desc desired_mech_attrs = GSS_C_NO_OID_SET; |
| 849 | gss_OID_set_desc except_mech_attrs = GSS_C_NO_OID_SET; |
| 850 | gss_OID_set_desc critical_mech_attrs = GSS_C_NO_OID_SET; |
| 851 | gss_OID_set_desc mechs = new gss_OID_set_desc(); |
| 852 | maj_status = gsswrapper.gss_indicate_mechs_by_attrs(min_status, |
| 853 | desired_mech_attrs, except_mech_attrs, critical_mech_attrs, |
| 854 | mechs); |