boolean bound = args[0].equals("bound");
String name = "host." + OneKDC.REALM_LOWER_CASE;
new OneKDC(null).writeJAASConf();
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
HashMap clntprops = new HashMap();
clntprops.put(Sasl.QOP, args[1]);
SaslClient sc = Sasl.createSaslClient( new String[]{"GSSAPI"}, null, "server",
name, clntprops, null);
final HashMap srvprops = new HashMap();
srvprops.put(Sasl.QOP, "auth,auth-int,auth-conf");
SaslServer ss = Sasl.createSaslServer("GSSAPI", "server",
bound? name: null, srvprops, new CallbackHandler() { publicvoid handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback cb : callbacks) { if (cb instanceof RealmCallback) {
((RealmCallback) cb).setText(OneKDC.REALM);
} elseif (cb instanceof AuthorizeCallback) {
((AuthorizeCallback) cb).setAuthorized(true);
}
}
}
});
byte[] token = newbyte[0]; byte[] lastClientToken = null; while (!sc.isComplete() || !ss.isComplete()) { if (!sc.isComplete()) {
token = sc.evaluateChallenge(token);
lastClientToken = token;
} if (!ss.isComplete()) {
token = ss.evaluateResponse(token);
}
} if (!bound) {
String boundName = (String)ss.getNegotiatedProperty(
Sasl.BOUND_SERVER_NAME); if (!boundName.equals(name)) { thrownew Exception("Wrong bound server name");
}
}
Object key = ss.getNegotiatedProperty( "com.sun.security.jgss.inquiretype.krb5_get_session_key"); if (key == null) { thrownew Exception("Extended negotiated property not read");
}
if (args[1].equals("auth")) { // 8170732. These are the maximum size bytes after jgss/krb5 wrap. if (lastClientToken[17] != 0 || lastClientToken[18] != 0
|| lastClientToken[19] != 0) { thrownew Exception("maximum size for auth must be 0");
}
} else { byte[] hello = "hello".getBytes();
token = sc.wrap(hello, 0, hello.length);
token = ss.unwrap(token, 0, token.length); if (!Arrays.equals(hello, token)) { thrownew Exception("Message altered");
}
}
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.