-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added 802.1x support; added support for pref key for finding password…
… based on type=password
- Loading branch information
Showing
19 changed files
with
896 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
#import "XCredsLoginPlugin.h" | ||
#import "TCSUnifiedLogger.h" | ||
#import "TCSReturnWindow.h" | ||
#import "TCSKeychain.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// NSData+HexString.h | ||
// Identity Manager | ||
// | ||
// Created by Timothy Perfitt on 12/29/19. | ||
// Copyright © 2020 Twocanoes Software, Inc. All rights reserved. | ||
// | ||
|
||
|
||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NSData (HexString) | ||
+(id)dataWithHexString:(NSString *)hex; | ||
- (NSString *)hexString; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// NSData+HexString.m | ||
// Identity Manager | ||
// | ||
// Created by Timothy Perfitt on 12/29/19. | ||
// Copyright © 2019 Twocanoes Software, Inc. All rights reserved. | ||
// | ||
|
||
#import "NSData+HexString.h" | ||
|
||
@implementation NSData (HexString) | ||
- (NSString *)hexString { | ||
|
||
NSUInteger capacity = self.length * 2; | ||
NSMutableString *stringBuffer = [NSMutableString stringWithCapacity:capacity]; | ||
const unsigned char *dataBuffer = self.bytes; | ||
|
||
for (NSInteger i = 0; i < self.length; i++) { | ||
[stringBuffer appendFormat:@"%02lX", (unsigned long)dataBuffer[i]]; | ||
} | ||
|
||
return stringBuffer; | ||
} | ||
+(id)dataWithHexString:(NSString *)hex | ||
{ | ||
char buf[3]; | ||
buf[2] = '\0'; | ||
|
||
NSString *currHex=hex; | ||
if ([hex hasPrefix:@"0x"] || [hex hasPrefix:@"0X"] ) { | ||
currHex=[hex substringFromIndex:2]; | ||
} | ||
if ([currHex length] % 2 !=0) { | ||
return nil; | ||
} | ||
|
||
unsigned char *bytes = malloc([currHex length]/2); | ||
unsigned char *bp = bytes; | ||
for (CFIndex i = 0; i < [currHex length]; i += 2) { | ||
buf[0] = [currHex characterAtIndex:i]; | ||
buf[1] = [currHex characterAtIndex:i+1]; | ||
char *b2 = NULL; | ||
*bp++ = strtol(buf, &b2, 16); | ||
if (b2 != buf + 2) { | ||
NSLog(@"String should be all hex digits: %@ (bad digit around %ld)", currHex, i); | ||
return nil; | ||
} | ||
} | ||
|
||
return [NSData dataWithBytesNoCopy:bytes length:[currHex length]/2 freeWhenDone:YES]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// NSData+SHA1.h | ||
// TCSToken | ||
// | ||
// Created by Timothy Perfitt on 12/29/19. | ||
// Copyright © 2019 Twocanoes Software, Inc. All rights reserved. | ||
// | ||
|
||
|
||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
|
||
@interface NSData (SHA1) | ||
- (NSData *)sha1; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// NSData+SHA1.m | ||
// TCSToken | ||
// | ||
// Created by Timothy Perfitt on 12/29/19. | ||
// Copyright © 2019 Twocanoes Software, Inc. All rights reserved. | ||
// | ||
|
||
#import "NSData+SHA1.h" | ||
#import <Security/Security.h> | ||
#import <CommonCrypto/CommonDigest.h> | ||
#import <CommonCrypto/CommonCryptor.h> | ||
|
||
|
||
@implementation NSData (SHA1) | ||
- (NSData *)sha1 | ||
{ | ||
CC_SHA1_CTX ctx; | ||
uint8_t *hashBytes = NULL; | ||
NSData *hash = nil; | ||
|
||
// Malloc a buffer to hold hash. | ||
hashBytes = malloc(CC_SHA1_DIGEST_LENGTH * sizeof(uint8_t)); | ||
memset((void *)hashBytes, 0x0, CC_SHA1_DIGEST_LENGTH); | ||
|
||
// Initialize the context. | ||
CC_SHA1_Init(&ctx); | ||
// Perform the hash. | ||
CC_SHA1_Update(&ctx, (void *)[self bytes], (CC_LONG)[self length]); | ||
// Finalize the output. | ||
CC_SHA1_Final(hashBytes, &ctx); | ||
|
||
// Build up the SHA1 blob. | ||
hash = [NSData dataWithBytes:(const void *)hashBytes length:(NSUInteger)CC_SHA1_DIGEST_LENGTH]; | ||
|
||
if (hashBytes) free(hashBytes); | ||
|
||
return hash; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// | ||
// Copyright (c) 2014 Twocanoes. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface TCSKeychain : NSObject | ||
+ (NSArray *)keychainIdentities; | ||
+ (SecIdentityRef)findIdentityWithSubject:(NSString *)inSubject; | ||
+ (NSString *)randomPasswordLength:(NSUInteger)length; | ||
+ (NSString *)randomPassword; | ||
|
||
+ (NSDictionary *)attributesForService:(NSString *)service account:(NSString *)account accessGroup:(NSString *)accessGroup error:(NSError **)err; | ||
+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account accessGroup:(NSString *)accessGroup error:(NSError **)err; | ||
|
||
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account accessGroup:(NSString *)accessGroup; | ||
+ (BOOL)setPassword:(NSString *)password forAccount:(NSString *)account accessGroup:(NSString *)accessGroup; | ||
+ (NSString *)passwordForAccount:(NSString *)account accessGroup:(NSString *)accessGroup error:(NSError **)err; | ||
+ (void)findIdentityWithSHA1Hash:(NSData *)inHash returnIdentity:(SecIdentityRef *)returnIdentity; | ||
+ (NSArray *)availableIdentityInfo; | ||
+ (NSArray *)smartcardCertificateArrayFromKeychain; | ||
@end | ||
|
||
|
||
@interface TCSPassword : NSObject | ||
|
||
@property (nonatomic, copy) NSString *service; | ||
@property (nonatomic, copy) NSString *accessGroup; | ||
@property (nonatomic, copy) NSString *password; | ||
|
||
- (instancetype)initWithService:(NSString *)service account:(NSString *)account group:(NSString *)group; | ||
|
||
@end |
Oops, something went wrong.