Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 java.security.sasl.jmod - Security SASL Module
JDK 17 java.security.sasl.jmod is the JMOD file for JDK 17 Security SASL (Simple Authentication and Security Layer) module.
JDK 17 Security SASL module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.security.sasl.jmod.
JDK 17 Security SASL module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Security SASL module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.security.sasl.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/security/sasl/PlainClient.java
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.security.sasl;
import javax.security.sasl.*;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Implements the PLAIN SASL client mechanism.
* (<A
* HREF="http://ftp.isi.edu/in-notes/rfc2595.txt">RFC 2595</A>)
*
* @author Rosanna Lee
*/
final class PlainClient implements SaslClient {
private boolean completed = false;
private byte[] pw;
private String authorizationID;
private String authenticationID;
private static byte SEP = 0; // US-ASCII <NUL>
/**
* Creates a SASL mechanism with client credentials that it needs
* to participate in Plain authentication exchange with the server.
*
* @param authorizationID A possibly null string representing the principal
* for which authorization is being granted; if null, same as
* authenticationID
* @param authenticationID A non-null string representing the principal
* being authenticated. pw is associated with this principal.
* @param pw A non-null byte[] containing the password.
*/
PlainClient(String authorizationID, String authenticationID, byte[] pw)
throws SaslException {
if (authenticationID == null || pw == null) {
throw new SaslException(
"PLAIN: authorization ID and password must be specified");
}
this.authorizationID = authorizationID;
this.authenticationID = authenticationID;
this.pw = pw; // caller should have already cloned
}
/**
* Retrieves this mechanism's name for to initiate the PLAIN protocol
* exchange.
*
* @return The string "PLAIN".
*/
public String getMechanismName() {
return "PLAIN";
}
public boolean hasInitialResponse() {
return true;
}
public void dispose() throws SaslException {
clearPassword();
}
/**
* Retrieves the initial response for the SASL command, which for
* PLAIN is the concatenation of authorization ID, authentication ID
* and password, with each component separated by the US-ASCII <NUL> byte.
*
* @param challengeData Ignored
* @return A non-null byte array containing the response to be sent to the server.
* @throws IllegalStateException if authentication already completed
*/
public byte[] evaluateChallenge(byte[] challengeData) {
if (completed) {
throw new IllegalStateException(
"PLAIN authentication already completed");
}
completed = true;
byte[] authz = (authorizationID != null)
? authorizationID.getBytes(UTF_8)
: null;
byte[] auth = authenticationID.getBytes(UTF_8);
byte[] answer = new byte[pw.length + auth.length + 2 +
(authz == null ? 0 : authz.length)];
int pos = 0;
if (authz != null) {
System.arraycopy(authz, 0, answer, 0, authz.length);
pos = authz.length;
}
answer[pos++] = SEP;
System.arraycopy(auth, 0, answer, pos, auth.length);
pos += auth.length;
answer[pos++] = SEP;
System.arraycopy(pw, 0, answer, pos, pw.length);
clearPassword();
return answer;
}
/**
* Determines whether this mechanism has completed.
* Plain completes after returning one response.
*
* @return true if has completed; false otherwise;
*/
public boolean isComplete() {
return completed;
}
/**
* Unwraps the incoming buffer.
*
* @throws SaslException Not applicable to this mechanism.
*/
public byte[] unwrap(byte[] incoming, int offset, int len)
throws SaslException {
if (completed) {
throw new SaslException(
"PLAIN supports neither integrity nor privacy");
} else {
throw new IllegalStateException("PLAIN authentication not completed");
}
}
/**
* Wraps the outgoing buffer.
*
* @throws SaslException Not applicable to this mechanism.
*/
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (completed) {
throw new SaslException(
"PLAIN supports neither integrity nor privacy");
} else {
throw new IllegalStateException("PLAIN authentication not completed");
}
}
/**
* Retrieves the negotiated property.
* This method can be called only after the authentication exchange has
* completed (i.e., when {@code isComplete()} returns true); otherwise, a
* {@code SaslException} is thrown.
*
* @return value of property; only QOP is applicable to PLAIN.
* @exception IllegalStateException if this authentication exchange
* has not completed
*/
public Object getNegotiatedProperty(String propName) {
if (completed) {
if (propName.equals(Sasl.QOP)) {
return "auth";
} else {
return null;
}
} else {
throw new IllegalStateException("PLAIN authentication not completed");
}
}
private void clearPassword() {
if (pw != null) {
// zero out password
for (int i = 0; i < pw.length; i++) {
pw[i] = (byte)0;
}
pw = null;
}
}
@SuppressWarnings("deprecation")
protected void finalize() {
clearPassword();
}
}
⏎ com/sun/security/sasl/PlainClient.java
Or download all of them as a single archive file:
File name: java.security.sasl-17.0.5-src.zip File size: 78831 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.smartcardio.jmod - Smart Card IO Module
2023-10-27, ∼6627🔥, 0💬
Popular Posts:
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solut...
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...