Skip to content

Sample Android Kerberos Application using cross-compiled MIT Kerberos libraries and CyaSSL Embedded SSL Library.

Notifications You must be signed in to change notification settings

kaduk/kerberos-android-ndk

 
 

Repository files navigation

Kerberos Android NDK Sample Application

This is a sample Android NDK application which acts as a simple GUI wrapper
around the MIT Kerberos kinit, klist, kvno, and kdestroy client 
applications as well as provides a sample client which uses the Java 
GSS-API interface. The GSS-API interface is a Java wrapper for the existing 
Kerberos GSS-API C-bindings and was created using SWIG. 

This package includes cross-compiled versions of the MIT Kerberos
libraries as well as the CyaSSL Embedded SSL Library. It should be 
helpful to Android developers who are interested in using the 
Kerberos libraries or the GSS-API interface in their own Android NDK 
Applications.

By default, this package uses pre-built static Kerberos and CyaSSL 
libraries which are needed in order to be linked to the KerberosApp 
application's native library (libkerberosapp.so).

For detailed information on the Java GSS-API interface, please see the
GSSAPI_README file included in this project's root directory.

===========================================================================
REQUIREMENTS:

Before building or installing this package, you must have the Android SDK
and NDK installed and set up on your system. It is also helpful to have the
Android Emulator set up and configured with an Android platform greater
than or equal to version 2.3.3 (Gingerbread). For details on downloading and 
setting these up, please see the following links:

Android SDK:  http://developer.android.com/sdk/index.html
Android NDK:  http://developer.android.com/sdk/ndk/index.html
Android Emulator:
https://developer.android.com/guide/developing/tools/emulator.html

===========================================================================
BUILDING:

To build and install this package, including Java GSS-API bindings, run
the following commands. If you would like to use the GSS-API example
client, please update your client and server settings in
./src/edu/mit/kerberos/KerberosAppActivity.java before building the project.

android update project -p . -s
swig -java -package edu.mit.kerberos -outdir ./src/edu/mit/kerberos
     -o ./jni/gsswrapper_wrap.c ./jni/gsswrapper.i
ndk-build
ant debug

If you want to rebuild the pre-built Kerberos libraries, please use the
android-config.sh shell script. This will allow the MIT Kerberos libraries
to be cross-compiled for the Android platform. More detailed instructions 
can be found in the script comments.

NOTE: The SWIG GSS-API wrapper code takes care of loading the shared
library using the System.loadLibrary(...) method. This means that you
don't have to call System.loadLibrary() from your Java application 
code, but you will need to verify the library name is correct in
gsswrapper.i before running the "swig", "ndk-build", and "ant debug"
commands.

===========================================================================
INSTALLING:

To install this package in a running Android emulator, run:

ant install

Before running the KerberosApp application, the user needs to install both
a Keytab file and a Kerberos configuration file. Reference the MIT Kerberos
documentation for guidelines for creating these files. Once created, they
can be installed using the adb push command, using:

adb push <local-file-path> <destination-file-path>

For example, to load a krb5.conf and krb5.keytab file from the current 
directory to an Android emulator under the /data/local/kerberos 
directory, run:

adb push krb5.conf /data/local/kerberos/
adb push krb5.keytab /data/local/kerberos/

The keytab file needs to contain an entry for the client principal (whose
TGT will be obtained by using the "kinit" button in the sample Application.
In order for the example client functionality to work, this same principal
must be entered in KerberosAppActivity.java as clientName.

NOTE: hosts file
----------------
If you need to edit the hosts file on the android emulator to accomidate for
KDC locations, use the following steps:

emulator -avd <name> -partition-size 128
adb remount
adb pull /system/etc/hosts ./
<< edit hosts file on local machine >>
adb push ./hosts /system/etc

===========================================================================
DEFAULT STORAGE LOCATIONS:

The following locations are the default paths used for the Kerberos
sample application.

Kerberos config file:   /data/local/kerberos/krb5.conf
Credentials cache:      /data/local/kerberos/ccache/krb5cc_<uid>
Keytab:                 /data/local/kerberos/krb5.keytab

The credentials cache location may be changed in KerberosAppActivity.java.
The Kerberos config file and keytab file locations may be changed by editing
the default locations in ./include/osconf.h when cross compiling the MIT 
kerberos libraries.

===========================================================================
LIBRARY VERSIONS:

The CyaSSL and Kerberos libraries used in this package:

CyaSSL 2.0.0rc3     
    http://www.yassl.com

Kerberos SVN trunk (downloaded 11/7/2011)   
    http://web.mit.edu/kerberos/

===========================================================================
LICENSES:

CyaSSL Embedded SSL Library -----------------------------------------------

 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
 *
 * CyaSSL is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * CyaSSL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

 
MIT Kerberos Libraries: ---------------------------------------------------

 * Copyright 1990, 2008 by the Massachusetts Institute of Technology.
 * All Rights Reserved.
 *
 * Export of this software from the United States of America may
 *   require a specific license from the United States Government.
 *   It is the responsibility of any person or organization contemplating
 *   export to obtain such a license before exporting.
 *
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 * distribute this software and its documentation for any purpose and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of M.I.T. not be used in advertising or publicity pertaining
 * to distribution of the software without specific, written prior
 * permission.  Furthermore if you modify this software you must label
 * your software as modified software and not distribute it in such a
 * fashion that it might be confused with the original M.I.T. software.
 * M.I.T. makes no representations about the suitability of
 * this software for any purpose.  It is provided "as is" without express
 * or implied warranty.

===========================================================================
SUPPORT:

If you have any questions or comments, please contact
[email protected] or the MIT Kerberos community.

About

Sample Android Kerberos Application using cross-compiled MIT Kerberos libraries and CyaSSL Embedded SSL Library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published