From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:33:39 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>SSLConnection</name> <environment>Net</environment> <super>Net.NetConnection</super> <private>false</private> none sslContext sslConnection validationBlock hostName <imports> Security.* </imports> <category>Net-SecureConnection-Support</category> <attributes> <package>NetSecureConnection</package> </attributes> </class> <comment> Net.SSLConnection
SSLConnection is an abstract superclass for client connections using a communication channel secured with SSL protocol. It integrates necessary SSL infrastructure with the Net client. For detailed explanation of various SSL related aspect, please, refer to the comments in the SSL package. Instance Variables: sslConnection <Security.SSLConnection> SSL connection between two parties sslContext <SSLContext> environment for SSL communication validationBlock <BlockClosure> subject validation block for server certificate hostName <String> host name
</comment> <methods> Net.SSLConnection <category>accessing</category>
sslContext ^sslContext ifNil: [ sslContext := SSLContext newWithSecureCipherSuites ].
sslContext: anSSLContext sslContext := anSSLContext
validationBlock ^validationBlock isNil ifTrue: [ [ :dnd | "Let's emulate web browser validation as default" hostName = (dnd at: 'CN') ] ] ifFalse: [ validationBlock ]
validationBlock: aBlock validationBlock := aBlock
</methods> <methods> Net.SSLConnection <category>private</category>
setupLogging sslConnection when: #receivingSignedBytes:size: do: [ :bytes :size | self class log: '****************Receiving Signed Bytes****************' level: #SSLConnection. self class log: (bytes copyFrom: 1 to: size) asString level: #SSLConnection ]. sslConnection when: #sendingSignedBytes:size: do: [ :bytes :size | self class log: '****************Sending Signed Bytes******************' level: #SSLConnection. self class log: (bytes copyFrom: 1 to: size) asString level: #SSLConnection].
sslConnection ^sslConnection
</methods> <methods> Net.SSLConnection <category>initialize-release</category>
openStreamFor: hNameString port: aNumber timeout: tmNumber self disconnect. hostName := hNameString. sslConnection := self sslContext connectionFor: (self socketStreamWithEncoding: #binary host: hNameString port: aNumber timeout: tmNumber). [ sslConnection connectSubject: self validationBlock. ] ifCurtailed: [ sslConnection shutdown. ]. self setupLogging. stream := (sslConnection withEncoding: self defaultEncoding) readAppendStream lineEndConvention: self defaultLineEndConvention. ^stream
sslContext: aSSLContext validationBlock: aBlock sslContext := aSSLContext. validationBlock := aBlock
</methods> <methods> Net.SSLConnection <category>testing</category>
isSecure ^true
</methods> <methods> Net.SSLConnection <category>stream</category>
disconnect sslConnection ifNotNil: [ [sslConnection close] ensure: [sslConnection := nil ]]. hostName := nil. super disconnect.
</methods> <methods> Net.SSLConnection class <category>instance creation</category>
sslContext: aSSLContext ^self new sslContext: aSSLContext; yourself
sslContext: aSSLContext validationBlock: aBlock ^self new sslContext: aSSLContext validationBlock: aBlock; yourself
validationBlock: aBlock ^self new validationBlock: aBlock; yourself
</methods> <methods> Net.SSLConnection class <category>debugging</category>
debugLabelsAndValues ^OrderedCollection new add: ((#SSLConnection << #net >> 'SSL Connection')->#SSLConnection); yourself
log: aString level: aLevel #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default log: aString level: aLevel ]
menuItemName ^(#SSLConnectionMessages << #net >> 'SSL Connection Messages')
registerToDebug #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default addToDebug: self ]
</methods> <methods> Net.SSLConnection class <category>class initialization</category>
initialize "self initialize." self registerToDebug.
</methods> <initialize> Net.SSLConnection </initialize> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>NetConnection</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none stream encoding <imports> private OS.IOConstants.* </imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class>