1

我想编写一个简单的程序,通过调用 gss-api 来实现客户端和服务器之间的安全通信。我尝试这样:

        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);

但是我在创建 GSSCredential 时遇到了 GSSException。

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)

有人知道原因吗?

4

0 回答 0