1

I want to write a simple program that implements security communication between client and server by calling gss-api. I try like this:

        mgr = GSSManager.getInstance();

        krb5Mechanism = new Oid("1.2.840.113554.1.2.2");
        krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1");

        serviceName = mgr.createName(serviceNameStr, krb5PrincipalNameType);
        cred = mgr.createCredential(serviceName, GSSCredential.INDEFINITE_LIFETIME, krb5Mechanism, GSSCredential.ACCEPT_ONLY);

But I got a GSSException when created the GSSCredential.

GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos credentails)
at sun.security.jgss.krb5.Krb5AcceptCredential.getInstance(Unknown Source)
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Unknown Source)
at sun.security.jgss.GSSManagerImpl.getCredentialElement(Unknown Source)
at sun.security.jgss.GSSCredentialImpl.add(Unknown Source)
at sun.security.jgss.GSSCredentialImpl.<init>(Unknown Source)
at sun.security.jgss.GSSManagerImpl.createCredential(Unknown Source)
at com.juan.gssapi.SimpleGSSAPIServer.loop(SimpleGSSAPIServer.java:55)
at com.juan.gssapi.SimpleGSSAPIServer.main(SimpleGSSAPIServer.java:36)

Does anybody know the reason?

juaney2012
  • 11
  • 3
  • Did you provide a login.conf which points to the credential cache? – Michael-O May 07 '13 at 20:04
  • no.I'm a beginner to GSS-API, and i want to know the relationship of kerberos and gss-api. And if i don't want to use kerberos as the under-level mechanism, how could i do with gss-api. i use the java-binding.Thank you for your help! – juaney2012 May 17 '13 at 02:30
  • You cannot use Kerberos direct. You do through GSS-API only. You should start with this one: http://docs.oracle.com/javase/1.5.0/docs/guide/security/jgss/tutorials/ – Michael-O May 17 '13 at 07:47

0 Answers0