Skip to content

Commit

Permalink
add additional ssl handshake error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Vandriel committed Jan 14, 2015
1 parent 4671c60 commit db1795a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Change Log

### master (unreleased)

* Add SSL handshake error codes

### 0.6.0 (2014-10-30)

* Remove kNWSuccess
Expand Down
6 changes: 6 additions & 0 deletions Classes/NWSSLConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ - (BOOL)handshakeSSLWithError:(NSError *__autoreleasing *)error
case errSSLWouldBlock: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeTimeout error:error];
case errSecIO: return [NWErrorUtil noWithErrorCode:kNWErrorSSLDroppedByServer error:error];
case errSecAuthFailed: return [NWErrorUtil noWithErrorCode:kNWErrorSSLAuthFailed error:error];
case errSSLUnknownRootCert: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeUnknownRootCert error:error];
case errSSLNoRootCert: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeNoRootCert error:error];
case errSSLCertExpired: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeCertExpired error:error];
case errSSLXCertChainInvalid: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeXCertChainInvalid error:error];
case errSSLClientCertRequested: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeClientCertRequested error:error];
case errSSLServerAuthCompleted: return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeServerAuthCompleted error:error];
}
return [NWErrorUtil noWithErrorCode:kNWErrorSSLHandshakeFail error:error];
}
Expand Down
12 changes: 12 additions & 0 deletions Classes/NWType.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ typedef NS_ENUM(NSInteger, NWError) {
kNWErrorSSLAuthFailed = -208,
/** SSL handshake failed. */
kNWErrorSSLHandshakeFail = -209,
/** SSL handshake root not a known anchor. */
kNWErrorSSLHandshakeUnknownRootCert = -223,
/** SSL handshake chain not verifiable to root. */
kNWErrorSSLHandshakeNoRootCert = -224,
/** SSL handshake chain has expired certificates. */
kNWErrorSSLHandshakeCertExpired = -225,
/** SSL handshake invalid certificate chain. */
kNWErrorSSLHandshakeXCertChainInvalid = -226,
/** SSL handshake expecting client cert. */
kNWErrorSSLHandshakeClientCertRequested = -227,
/** SSL handshake auth interrupted. */
kNWErrorSSLHandshakeServerAuthCompleted = -228,
/** SSL handshake timeout. */
kNWErrorSSLHandshakeTimeout = -218,

Expand Down
6 changes: 6 additions & 0 deletions Classes/NWType.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ + (NSString *)stringWithCode:(NWError)code
case kNWErrorSSLDroppedByServer : return @"SSL handshake dropped by server";
case kNWErrorSSLAuthFailed : return @"SSL handshake authentication failed";
case kNWErrorSSLHandshakeFail : return @"SSL handshake failed";
case kNWErrorSSLHandshakeUnknownRootCert : return @"SSL handshake root not a known anchor";
case kNWErrorSSLHandshakeNoRootCert : return @"SSL handshake chain not verifiable to root";
case kNWErrorSSLHandshakeCertExpired : return @"SSL handshake chain has expired certificates";
case kNWErrorSSLHandshakeXCertChainInvalid : return @"SSL handshake invalid certificate chain";
case kNWErrorSSLHandshakeClientCertRequested : return @"SSL handshake expecting client cert";
case kNWErrorSSLHandshakeServerAuthCompleted : return @"SSL handshake auth interrupted";
case kNWErrorSSLHandshakeTimeout : return @"SSL handshake timeout";

case kNWErrorReadDroppedByServer : return @"Read connection dropped by server";
Expand Down

0 comments on commit db1795a

Please sign in to comment.