Package com.hierynomus.smbj.connection
Class SMBSessionBuilder
- java.lang.Object
-
- com.hierynomus.smbj.connection.SMBSessionBuilder
-
public class SMBSessionBuilder extends java.lang.Object
[MS-SMB2] 3.2.5.3.1 Handling a New Authentication
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMBSessionBuilder.BuilderContext
static interface
SMBSessionBuilder.SessionFactory
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
AES_128_CMAC_ALGORITHM
private SmbConfig
config
private Connection
connection
private ConnectionContext
connectionContext
(package private) static java.lang.String
HMAC_SHA256_ALGORITHM
(package private) static byte[]
KDF_APP_CONTEXT
(package private) static byte[]
KDF_APP_LABEL
(package private) static byte[]
KDF_APP_LABEL_SMB311
(package private) static byte[]
KDF_DEC_CONTEXT
(package private) static byte[]
KDF_DEC_LABEL_SMB311
(package private) static byte[]
KDF_ENC_CONTEXT
(package private) static byte[]
KDF_ENC_LABEL_SMB311
(package private) static byte[]
KDF_ENCDEC_LABEL
(package private) static byte[]
KDF_SIGN_CONTEXT
(package private) static byte[]
KDF_SIGN_LABEL
(package private) static byte[]
KDF_SIGN_LABEL_SMB311
private static org.slf4j.Logger
logger
private SessionTable
preauthSessionTable
private SMBSessionBuilder.SessionFactory
sessionFactory
private SessionTable
sessionTable
-
Constructor Summary
Constructors Constructor Description SMBSessionBuilder(Connection connection, SmbConfig config, SMBSessionBuilder.SessionFactory sessionFactory)
-
Method Summary
-
-
-
Field Detail
-
KDF_ENC_LABEL_SMB311
static final byte[] KDF_ENC_LABEL_SMB311
-
KDF_DEC_LABEL_SMB311
static final byte[] KDF_DEC_LABEL_SMB311
-
KDF_ENCDEC_LABEL
static final byte[] KDF_ENCDEC_LABEL
-
KDF_ENC_CONTEXT
static final byte[] KDF_ENC_CONTEXT
-
KDF_DEC_CONTEXT
static final byte[] KDF_DEC_CONTEXT
-
KDF_SIGN_CONTEXT
static final byte[] KDF_SIGN_CONTEXT
-
KDF_SIGN_LABEL
static final byte[] KDF_SIGN_LABEL
-
KDF_SIGN_LABEL_SMB311
static final byte[] KDF_SIGN_LABEL_SMB311
-
KDF_APP_CONTEXT
static final byte[] KDF_APP_CONTEXT
-
KDF_APP_LABEL
static final byte[] KDF_APP_LABEL
-
KDF_APP_LABEL_SMB311
static final byte[] KDF_APP_LABEL_SMB311
-
HMAC_SHA256_ALGORITHM
static final java.lang.String HMAC_SHA256_ALGORITHM
- See Also:
- Constant Field Values
-
AES_128_CMAC_ALGORITHM
static final java.lang.String AES_128_CMAC_ALGORITHM
- See Also:
- Constant Field Values
-
logger
private static final org.slf4j.Logger logger
-
config
private final SmbConfig config
-
connectionContext
private final ConnectionContext connectionContext
-
sessionFactory
private final SMBSessionBuilder.SessionFactory sessionFactory
-
sessionTable
private final SessionTable sessionTable
-
preauthSessionTable
private final SessionTable preauthSessionTable
-
connection
private final Connection connection
-
-
Constructor Detail
-
SMBSessionBuilder
public SMBSessionBuilder(Connection connection, SmbConfig config, SMBSessionBuilder.SessionFactory sessionFactory)
-
-
Method Detail
-
establish
public Session establish(AuthenticationContext authContext)
Establish a new session on the connection using the passed credentials.- Returns:
- a (new) Session that is authenticated for the user.
-
newContext
private SMBSessionBuilder.BuilderContext newContext(AuthenticationContext authContext, Authenticator authenticator)
-
setupSession
private Session setupSession(SMBSessionBuilder.BuilderContext ctx) throws java.io.IOException
- Throws:
java.io.IOException
-
newSession
private Session newSession(SMBSessionBuilder.BuilderContext ctx)
-
processAuthenticationToken
private void processAuthenticationToken(SMBSessionBuilder.BuilderContext ctx, byte[] inputToken) throws java.io.IOException
- Throws:
java.io.IOException
-
initiateSessionSetup
private SMBSessionBuilder.BuilderContext initiateSessionSetup(SMBSessionBuilder.BuilderContext ctx, byte[] securityContext) throws TransportException
- Throws:
TransportException
-
getAuthenticator
private Authenticator getAuthenticator(AuthenticationContext context) throws SpnegoException
- Throws:
SpnegoException
-
validateAndSetSigning
private void validateAndSetSigning(SMBSessionBuilder.BuilderContext ctx, SessionContext context)
-
updatePreauthIntegrityValue
private void updatePreauthIntegrityValue(SMBSessionBuilder.BuilderContext ctx, SessionContext sessionContext, SMB2Packet packet)
-
deriveKeys
private void deriveKeys(SMB2SessionSetup response, SMB2Dialect dialect, SessionContext context)
-
deriveKey
private javax.crypto.SecretKey deriveKey(javax.crypto.SecretKey derivationKey, byte[] label, byte[] context, java.lang.String algorithm)
-
-