Class SSLCommProps
- All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
This property container contains all properties required for a SSL Socket (NIO) connection.
Field Summary
Fields inherited from class PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_ATTR_STRING_SECRET, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EQC_SAVE_RELEVANT_ONLY, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsConstructorDescriptionCreates the socket property container without a name.SSLCommProps(Atom propertyAtom) Creates the socket property container with the specified name.Method Summary
Modifier and TypeMethodDescriptionclone()Clones the settings: the clone gets a trust manager of its own and its own session decisions, and no cached SSL context, callback or client certificate password.createClientSSLEngine(String serverDescription) Creates a Client SSL Engine for the NIO socket communication initialized with these parameters.Gets the callback assigned to the properties.Gets the Client Certificate description.getClientCertificateKeyManagers(String serverDescription, char[] password, ICertificateUI callback) Gets the keystore for the Client Certificate.booleanGets server authentication globally.booleanGets server authentication using callback interfacecom.iizix.nio.ICertificateUI: a server certificate that is not trusted is shown to the user to accept or refuse, when a callback is installed.Gets the Server Authentication certificates.booleanGets strong cipher encryption requirement, 128 bits or more.booleanChecks if the password is saved for the Client Certificate.protected voidZeroes the cached client certificate password when the properties are disposed of.static voidForgets the certificates the user accepted or refused through the callback, in every instance of this JVM: each drops its decisions at its next check.voidsetCallback(ICertificateUI callback) Assigns the callback interface to this instance of the properties.voidsetClientCertificate(String fileName, char[] password, boolean doSavePassword) Sets or removed the Client Certificate.voidsetHostName(String hostName) Assigns the Host Name once a session has been established with a socket.voidsetServerAuthentication(boolean on) Sets server authentication globally.voidsetServerAuthenticationCallback(boolean on) Sets server authentication using callback interfacecom.iizix.nio.ICertificateUI.voidsetServerAuthenticationCertificates(X509Certificate[] certificates) Sets or removes server authentication using the specified certificates.voidsetStrongCipher(boolean on) Sets strong cipher encryption requirement, 128 bits or more.booleanChecks a Client Certificate is used.Methods inherited from class PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializePropTree, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropErrorPersisted, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropForEditorAtCreation, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropSaveRelevant, isPropSecret, isPropSecretCapable, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onInitialize, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropSecret, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toShortString, toShortString, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Constructor Details
SSLCommProps
public SSLCommProps()Creates the socket property container without a name. The name must be set in all cases using thesetPropertyAtomcall.SSLCommProps
Creates the socket property container with the specified name. All system-reserved names for components begins with "$".- Parameters:
propertyAtom- the name of the component, unique within it's parent.
Method Details
resetServerCertificates
public static void resetServerCertificates()Forgets the certificates the user accepted or refused through the callback, in every instance of this JVM: each drops its decisions at its next check. The Designer's SSL page calls it before validating the settings, so a certificate refused once is asked about again.clone
Clones the settings: the clone gets a trust manager of its own and its own session decisions, and no cached SSL context, callback or client certificate password.setStrongCipher
public void setStrongCipher(boolean on) Sets strong cipher encryption requirement, 128 bits or more.- Parameters:
on- The enablement flag.
getStrongCipher
public boolean getStrongCipher()Gets strong cipher encryption requirement, 128 bits or more.- Returns:
- true if enabled, false if disabled. Default value is true.
setServerAuthentication
public void setServerAuthentication(boolean on) Sets server authentication globally. If off, all servers are accepted.- Parameters:
on- The enablement flag.
getServerAuthentication
public boolean getServerAuthentication()Gets server authentication globally. If off, all servers are accepted.- Returns:
- true if enabled, false if disabled. Default value is true.
setServerAuthenticationCallback
public void setServerAuthenticationCallback(boolean on) Sets server authentication using callback interfacecom.iizix.nio.ICertificateUI.- Parameters:
on- The enablement flag.
getServerAuthenticationCallback
public boolean getServerAuthenticationCallback()Gets server authentication using callback interfacecom.iizix.nio.ICertificateUI: a server certificate that is not trusted is shown to the user to accept or refuse, when a callback is installed. Without a callback (a headless server) this setting changes nothing.- Returns:
- true if enabled, false if disabled. Default value is true.
setServerAuthenticationCertificates
public void setServerAuthenticationCertificates(X509Certificate[] certificates) throws PropException, CertificateException Sets or removes server authentication using the specified certificates.- Parameters:
certificates- The certificates to accept, or null to remove certificate verification.- Throws:
PropException- If the property cannot be removed, set or added.CertificateEncodingException- If an encoding error occurs.CertificateException
getServerAuthenticationCertificates
Gets the Server Authentication certificates.- Returns:
- The array of server certificates (could be empty), or null if this authentication is disabled.
- Throws:
CertificateException- If no Provider supports a CertificateFactorySpi implementation for the specified type when creating the Certificate Factory, or when the certificate is initialized from the data.
setClientCertificate
public void setClientCertificate(String fileName, char[] password, boolean doSavePassword) throws PropException, FileNotFoundException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException Sets or removed the Client Certificate.- Parameters:
fileName- The file name of the PKCS#12 file, DER encoded, null to remove client certificate.password- The password, or null for none.doSavePassword- Flag to save the password. The password is saved "garbled" but not safe for "de-garbling", use with care.- Throws:
PropException- If the property cannot be removed, set or added.FileNotFoundException- If the file is not found.NoSuchAlgorithmException- If the algorithm used to check the integrity of the keystore cannot be found.CertificateException- If any of the certificates in the keystore could not be loaded.IOException- If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.UnrecoverableKeyException- If the key cannot be recovered (e.g. the given password is wrong).KeyStoreException
useClientCertificate
public boolean useClientCertificate()Checks a Client Certificate is used.getClientCertificateDescription
Gets the Client Certificate description.- Returns:
- null if none is present, otherwise the string.
hasSavedClientCertificatePassword
public boolean hasSavedClientCertificatePassword()Checks if the password is saved for the Client Certificate.getClientCertificateKeyManagers
public KeyManager[] getClientCertificateKeyManagers(String serverDescription, char[] password, ICertificateUI callback) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException Gets the keystore for the Client Certificate.If no
passwordorcallbackis set and the password is not saved, an error will be thrown.- Parameters:
serverDescription- The server description.password- The password, or null for none.callback- The callback to request the password from the user, null for none.- Returns:
- The keystore, or null if client certificate is not used or the user canceled the password dialog box.
- Throws:
KeyStoreException- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.NoSuchAlgorithmException- If the algorithm used to check the integrity of the keystore cannot be found.CertificateException- If any of the certificates in the keystore could not be loaded.IOException- If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.UnrecoverableKeyException- If the key cannot be recovered (e.g. the given password is wrong).
onPropDispose
protected void onPropDispose()Zeroes the cached client certificate password when the properties are disposed of.- Overrides:
onPropDisposein classPropCnr
createClientSSLEngine
public SSLEngine createClientSSLEngine(String serverDescription) throws NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException, KeyStoreException, NoSuchProviderException, KeyManagementException Creates a Client SSL Engine for the NIO socket communication initialized with these parameters. The SSL context for the settings is cached in order to provide a faster access the second time this method is called.- Parameters:
serverDescription- The server description.- Returns:
- The SSL Engine for the Client, initialized for Client mode.
- Throws:
KeyStoreException- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.NoSuchAlgorithmException- If the algorithm used to check the integrity of the keystore cannot be found.CertificateException- If any of the certificates in the keystore could not be loaded.IOException- If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.UnrecoverableKeyException- If the key cannot be recovered (e.g. the given password is wrong).NoSuchProviderException- TLS provider not found.KeyManagementException- Key management problems.
setHostName
Assigns the Host Name once a session has been established with a socket. This is then used for name clash verification with a server certificate.setCallback
Assigns the callback interface to this instance of the properties. Please note that it is not a good idea to do if it's not a new instance of the properties, e.g. if they are loaded from an XML file.getCallback
Gets the callback assigned to the properties.- Returns:
- The callback, or null if none has been set.