From 4eca08a459442c15abdb55282d2a8fad19212d3b Mon Sep 17 00:00:00 2001 From: Lobanov Dmitry Date: Mon, 29 Aug 2016 14:35:32 +0300 Subject: [PATCH 1/5] algorithms: rs hierarchy refactoring. rs256 header removed. --- .../Algorithms/RSFamily/JWTAlgorithmRS256.h | 14 - .../Algorithms/RSFamily/JWTAlgorithmRS256.m | 199 ----------- .../Algorithms/RSFamily/JWTAlgorithmRSBase.h | 8 +- .../Algorithms/RSFamily/JWTAlgorithmRSBase.m | 323 +++++++++++++----- Classes/Security/Security+MissingSymbols.h | 51 --- 5 files changed, 240 insertions(+), 355 deletions(-) delete mode 100644 Classes/Algorithms/RSFamily/JWTAlgorithmRS256.h delete mode 100644 Classes/Algorithms/RSFamily/JWTAlgorithmRS256.m delete mode 100644 Classes/Security/Security+MissingSymbols.h diff --git a/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.h b/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.h deleted file mode 100644 index de84fc0e..00000000 --- a/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// JWTAlgorithmRS256.h -// JWT -// -// Created by Lobanov Dmitry on 17.11.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import -#import "JWTRSAlgorithm.h" - -//@interface JWTAlgorithmRS256 : NSObject -// -//@end diff --git a/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.m b/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.m deleted file mode 100644 index 96f20efc..00000000 --- a/Classes/Algorithms/RSFamily/JWTAlgorithmRS256.m +++ /dev/null @@ -1,199 +0,0 @@ -// -// JWTAlgorithmRS256.m -// JWT -// -// Created by Lobanov Dmitry on 17.11.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import "JWTAlgorithmRS256.h" -#import "MF_Base64Additions.h" -#import -#import "Security+MissingSymbols.h" -#import "JWTAlgorithmRSBase.h" - -//@implementation JWTAlgorithmRS256 -// -//+ (instancetype)new { -// return [JWTAlgorithmRSBase algorithm256]; -//} -// -//+ (instancetype)alloc { -// return nil; -//} - -/*{ - NSString *_privateKeyCertificatePassphrase; -} - -#pragma mark - JWTAlgorithm - -+ (instancetype)new { - return [JWTAlgorithmRSBase algorithm256]; -} - -- (NSString *)name { - return @"RS256"; -} - -- (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret { - return [self encodePayloadData:[theString dataUsingEncoding:NSUTF8StringEncoding] - withSecret:[NSData dataWithBase64UrlEncodedString:theSecret]]; -} - -- (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData { - SecIdentityRef identity = nil; - SecTrustRef trust = nil; - extractIdentityAndTrust((__bridge CFDataRef)theSecretData, &identity, &trust, (__bridge CFStringRef) self.privateKeyCertificatePassphrase); - if (identity && trust) { - SecKeyRef privateKey; - SecIdentityCopyPrivateKey(identity, &privateKey); - return PKCSSignBytesSHA256withRSA(theStringData, privateKey); - } else { - return nil; - } -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey { - NSData *certificateData = [NSData dataWithBase64String:verificationKey]; - return [self verifySignedInput:input - withSignature:signature - verificationKeyData:certificateData]; -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData { - NSData *signedData = [input dataUsingEncoding:NSUTF8StringEncoding]; - NSData *signatureData = [NSData dataWithBase64UrlEncodedString:signature]; - SecKeyRef publicKey = [self publicKeyFromCertificate:verificationKeyData]; - BOOL signatureOk = PKCSVerifyBytesSHA256withRSA(signedData, signatureData, publicKey); - (CFRelease(publicKey)); - return signatureOk; -} - -#pragma mark - JWTRSAlgorithm - -- (NSString *)privateKeyCertificatePassphrase { - return _privateKeyCertificatePassphrase; -} - -- (void)setPrivateKeyCertificatePassphrase:(NSString *)privateKeyCertificatePassphrase { - _privateKeyCertificatePassphrase = privateKeyCertificatePassphrase; -} - -#pragma mark - Private - -- (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData { - SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData); - SecPolicyRef secPolicy = SecPolicyCreateBasicX509(); - SecTrustRef trust; - SecTrustCreateWithCertificates(certificate, secPolicy, &trust); - SecTrustResultType resultType; - SecTrustEvaluate(trust, &resultType); - SecKeyRef publicKey = SecTrustCopyPublicKey(trust); - (CFRelease(trust)); - (CFRelease(secPolicy)); - (CFRelease(certificate)); - return publicKey; -} - -BOOL PKCSVerifyBytesSHA256withRSA(NSData* plainData, NSData* signature, SecKeyRef publicKey) { - size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey); - const void* signedHashBytes = [signature bytes]; - - size_t hashBytesSize = CC_SHA256_DIGEST_LENGTH; - uint8_t* hashBytes = malloc(hashBytesSize); - if (!CC_SHA256([plainData bytes], (CC_LONG)[plainData length], hashBytes)) { - return false; - } - - OSStatus status = SecKeyRawVerify(publicKey, - kSecPaddingPKCS1SHA256, - hashBytes, - hashBytesSize, - signedHashBytes, - signedHashBytesSize); - - if (hashBytes) - free(hashBytes); - - return status == errSecSuccess; -} - -NSData* PKCSSignBytesSHA256withRSA(NSData* plainData, SecKeyRef privateKey) { - size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey); - uint8_t* signedHashBytes = malloc(signedHashBytesSize); - memset(signedHashBytes, 0x0, signedHashBytesSize); - - size_t hashBytesSize = CC_SHA256_DIGEST_LENGTH; - uint8_t* hashBytes = malloc(hashBytesSize); - if (!CC_SHA256([plainData bytes], (CC_LONG)[plainData length], hashBytes)) { - return nil; - } - - SecKeyRawSign(privateKey, - kSecPaddingPKCS1SHA256, - hashBytes, - hashBytesSize, - signedHashBytes, - &signedHashBytesSize); - - NSData* signedHash = [NSData dataWithBytes:signedHashBytes - length:(NSUInteger)signedHashBytesSize]; - - if (hashBytes) - free(hashBytes); - if (signedHashBytes) - free(signedHashBytes); - - return signedHash; -} - -OSStatus extractIdentityAndTrust(CFDataRef inPKCS12Data, - SecIdentityRef *outIdentity, - SecTrustRef *outTrust, - CFStringRef keyPassword) { - OSStatus securityError = errSecSuccess; - - - const void *keys[] = { kSecImportExportPassphrase }; - const void *values[] = { keyPassword }; - CFDictionaryRef optionsDictionary = NULL; - - // Create a dictionary containing the passphrase if one - // was specified. Otherwise, create an empty dictionary. - optionsDictionary = CFDictionaryCreate( - NULL, keys, - values, (keyPassword ? 1 : 0), - NULL, NULL); // 1 - - CFArrayRef items = NULL; - securityError = SecPKCS12Import(inPKCS12Data, - optionsDictionary, - &items); // 2 - - - // - if (securityError == 0) { // 3 - CFDictionaryRef myIdentityAndTrust = CFArrayGetValueAtIndex (items, 0); - const void *tempIdentity = NULL; - tempIdentity = CFDictionaryGetValue (myIdentityAndTrust, - kSecImportItemIdentity); - CFRetain(tempIdentity); - *outIdentity = (SecIdentityRef)tempIdentity; - const void *tempTrust = NULL; - tempTrust = CFDictionaryGetValue (myIdentityAndTrust, kSecImportItemTrust); - - CFRetain(tempTrust); - *outTrust = (SecTrustRef)tempTrust; - } - - if (optionsDictionary) // 4 - CFRelease(optionsDictionary); - - if (items) - CFRelease(items); - - return securityError; -}*/ - -//@end diff --git a/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.h b/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.h index 0f1c2273..4eaf9866 100644 --- a/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.h +++ b/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.h @@ -22,5 +22,11 @@ + (instancetype)algorithm256; + (instancetype)algorithm384; + (instancetype)algorithm512; ++ (instancetype)mutableAlgorithm __deprecated; -@end \ No newline at end of file +@end + +/* + // when you can't live without mutability, uncomment. + @class JWTAlgorithmRSFamilyMemberMutable; +*/ \ No newline at end of file diff --git a/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.m b/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.m index 54ce05b2..8e447f76 100644 --- a/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.m +++ b/Classes/Algorithms/RSFamily/JWTAlgorithmRSBase.m @@ -9,17 +9,36 @@ #import "JWTAlgorithmRSBase.h" #import "MF_Base64Additions.h" #import -#import "Security+MissingSymbols.h" + +/* +* * Possible inheritence * +* +* +* RSBase (Public + Create-category) +* / \ +* / \ +* RSBaseMac RSBaseIOS +* \ ifdef / +* \ / +* RSFamilyMember +* | +* RSFamilyMemberMutable +* +*/ +/* + TODO: rename RSBaseTest into RSFamilyMemberMutable +*/ @interface JWTAlgorithmRSBase() @end - @implementation JWTAlgorithmRSBase @synthesize privateKeyCertificatePassphrase; +#pragma mark - Override +// TODO: put assurance that algorithm was properly overriden? - (size_t)ccSHANumberDigestLength { return 0; } @@ -28,16 +47,15 @@ - (uint32_t)secPaddingPKCS1SHANumber { return 0; } -#pragma mark - JWTAlgorithm - - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { return nil; } - (NSString *)name { - return @"RSBase"; + return @"RSBase"; } +#pragma mark - JWTAlgorithm - (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret { return [self encodePayloadData:[theString dataUsingEncoding:NSUTF8StringEncoding] withSecret:[NSData dataWithBase64UrlEncodedString:theSecret]]; } @@ -71,8 +89,16 @@ - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature return signatureOk; } -#pragma mark - Private +#pragma mark - Private ( Override-part depends on platform ) +- (BOOL)PKCSVerifyBytesSHANumberWithRSA:(NSData *)plainData witSignature:(NSData *)signature withPublicKey:(SecKeyRef) publicKey { + return NO; +} +- (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(SecKeyRef)privateKey { + return nil; +} + +#pragma mark - Private Helpers - (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData { SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData); SecPolicyRef secPolicy = SecPolicyCreateBasicX509(); @@ -87,59 +113,6 @@ - (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData { return publicKey; } -- (BOOL)PKCSVerifyBytesSHANumberWithRSA:(NSData *)plainData witSignature:(NSData *)signature withPublicKey:(SecKeyRef) publicKey { - size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey); - const void* signedHashBytes = [signature bytes]; - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) { - return false; - } - - OSStatus status = SecKeyRawVerify(publicKey, - self.secPaddingPKCS1SHANumber, - hashBytes, - hashBytesSize, - signedHashBytes, - signedHashBytesSize); - - return status == errSecSuccess; -} - -- (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(SecKeyRef)privateKey { - size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey); - uint8_t* signedHashBytes = malloc(signedHashBytesSize); - memset(signedHashBytes, 0x0, signedHashBytesSize); - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - - // ([plainData bytes], (CC_LONG)[plainData length], hashBytes) - unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]; - - if (!str) { - return nil; - } - - SecKeyRawSign(privateKey, - self.secPaddingPKCS1SHANumber, - hashBytes, - hashBytesSize, - signedHashBytes, - &signedHashBytesSize); - - NSData* signedHash = [NSData dataWithBytes:signedHashBytes - length:(NSUInteger)signedHashBytesSize]; - - if (hashBytes) - free(hashBytes); - if (signedHashBytes) - free(signedHashBytes); - - return signedHash; -} - OSStatus __extractIdentityAndTrust(CFDataRef inPKCS12Data, SecIdentityRef *outIdentity, SecTrustRef *outTrust, @@ -190,8 +163,65 @@ OSStatus __extractIdentityAndTrust(CFDataRef inPKCS12Data, @end -#if TARGET_OS_MAC && !TARGET_OS_IPHONE +#if TARGET_OS_MAC && TARGET_OS_IPHONE +@interface JWTAlgorithmRSBaseIOS : JWTAlgorithmRSBase @end +@implementation JWTAlgorithmRSBaseIOS +- (BOOL)PKCSVerifyBytesSHANumberWithRSA:(NSData *)plainData witSignature:(NSData *)signature withPublicKey:(SecKeyRef) publicKey { + size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey); + const void* signedHashBytes = [signature bytes]; + + size_t hashBytesSize = self.ccSHANumberDigestLength; + uint8_t* hashBytes = malloc(hashBytesSize); + if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) { + return false; + } + + OSStatus status = SecKeyRawVerify(publicKey, + self.secPaddingPKCS1SHANumber, + hashBytes, + hashBytesSize, + signedHashBytes, + signedHashBytesSize); + + return status == errSecSuccess; +} +- (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(SecKeyRef)privateKey { + size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey); + uint8_t* signedHashBytes = malloc(signedHashBytesSize); + memset(signedHashBytes, 0x0, signedHashBytesSize); + + size_t hashBytesSize = self.ccSHANumberDigestLength; + uint8_t* hashBytes = malloc(hashBytesSize); + + // ([plainData bytes], (CC_LONG)[plainData length], hashBytes) + unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]; + + if (!str) { + return nil; + } + + SecKeyRawSign(privateKey, + self.secPaddingPKCS1SHANumber, + hashBytes, + hashBytesSize, + signedHashBytes, + &signedHashBytesSize); + + NSData* signedHash = [NSData dataWithBytes:signedHashBytes + length:(NSUInteger)signedHashBytesSize]; + + if (hashBytes) + free(hashBytes); + if (signedHashBytes) + free(signedHashBytes); + + return signedHash; +} +@end +#endif + +#if TARGET_OS_MAC && !TARGET_OS_IPHONE @interface JWTAlgorithmRSBaseMac : JWTAlgorithmRSBase @end @@ -226,12 +256,14 @@ - (NSData *)executeTransform:(SecTransformRef)transform withInput:(NSData *)inpu success = (resultRef != falseResultRef); } + BOOL positiveResult = success; // resultRef != falseResultRef + // error - if (errorRef) { + if (errorRef != NULL) { NSLog(@"%@ error: %@", self.debugDescription, (__bridge NSError *)errorRef); } else { - if (success) { + if (positiveResult) { resultData = (__bridge NSData *)resultRef; } } @@ -270,11 +302,18 @@ - (BOOL)PKCSVerifyBytesSHANumberWithRSA:(NSData *)plainData witSignature:(NSData // signedHashBytes, // signedHashBytesSize); // return status == errSecSuccess; - CFErrorRef errorRef; + + CFErrorRef errorRef = NULL; SecTransformRef transform = SecVerifyTransformCreate(publicKey, (__bridge CFDataRef)signature, &errorRef); // verification. false result is kCFBooleanFalse - return [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:kCFBooleanFalse] != nil; + BOOL result = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:kCFBooleanFalse] != nil; + + if (errorRef != NULL) { + CFRelease(errorRef); + } + + return result; } - (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(SecKeyRef)privateKey { @@ -297,7 +336,7 @@ - (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(Se return nil; } - CFErrorRef errorRef; + CFErrorRef errorRef = NULL; SecTransformRef transform = SecSignTransformCreate(privateKey, &errorRef); @@ -318,22 +357,110 @@ - (NSData *)PKCSSignBytesSHANumberwithRSA:(NSData *)plainData withPrivateKey:(Se // signing: false result is NULL. // it will release error. resultData = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:NULL]; + + if (errorRef != NULL) { + CFRelease(errorRef); + } + return resultData; } @end +#endif + -@interface JWTAlgorithmRSBaseTest : JWTAlgorithmRSBaseMac +// MacOS OR iOS is Base +#if TARGET_OS_MAC && !TARGET_OS_IPHONE +@interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseMac @end #else -@interface JWTAlgorithmRSBaseTest : JWTAlgorithmRSBase +@interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseIOS @end +#endif + +@interface JWTAlgorithmRS256 : JWTAlgorithmRSFamilyMember @end +@interface JWTAlgorithmRS384 : JWTAlgorithmRSFamilyMember @end +@interface JWTAlgorithmRS512 : JWTAlgorithmRSFamilyMember @end + +@implementation JWTAlgorithmRSFamilyMember +- (uint32_t)secPaddingPKCS1SHANumber { + return 0; +} +@end + +@implementation JWTAlgorithmRS256 + +- (size_t)ccSHANumberDigestLength { + return CC_SHA256_DIGEST_LENGTH; +} + +#if TARGET_OS_MAC && TARGET_OS_IPHONE +- (uint32_t)secPaddingPKCS1SHANumber { + return kSecPaddingPKCS1SHA256; +} #endif +- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { + return CC_SHA256(data, len, hashBytes); +} + +- (NSString *)name { + return @"RS256"; +} + +@end + +@implementation JWTAlgorithmRS384 + +- (size_t)ccSHANumberDigestLength { + return CC_SHA384_DIGEST_LENGTH; +} + +#if TARGET_OS_MAC && TARGET_OS_IPHONE +- (uint32_t)secPaddingPKCS1SHANumber { + return kSecPaddingPKCS1SHA384; +} +#endif + +- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { + return CC_SHA384(data, len, hashBytes); +} + +- (NSString *)name { + return @"RS384"; +} + +@end + +@implementation JWTAlgorithmRS512 + +- (size_t)ccSHANumberDigestLength { + return CC_SHA512_DIGEST_LENGTH; +} + +#if TARGET_OS_MAC && TARGET_OS_IPHONE +- (uint32_t)secPaddingPKCS1SHANumber { + return kSecPaddingPKCS1SHA512; +} +#endif + +- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { + return CC_SHA512(data, len, hashBytes); +} + +- (NSString *)name { + return @"RS512"; +} + +@end + + +@interface JWTAlgorithmRSFamilyMemberMutable : JWTAlgorithmRSFamilyMember + @property (assign, nonatomic, readwrite) size_t ccSHANumberDigestLength; @property (assign, nonatomic, readwrite) uint32_t secPaddingPKCS1SHANumber; -@property (assign, nonatomic, readwrite) unsigned char * (^ccShaNumberWithData)(const void *data, CC_LONG len, unsigned char *hashBytes); +@property (copy, nonatomic, readwrite) unsigned char * (^ccShaNumberWithData)(const void *data, CC_LONG len, unsigned char *hashBytes); @property (copy, nonatomic, readwrite) NSString *name; @end -@implementation JWTAlgorithmRSBaseTest +@implementation JWTAlgorithmRSFamilyMemberMutable @synthesize ccSHANumberDigestLength = _ccSHANumberDigestLength; @synthesize secPaddingPKCS1SHANumber = _secPaddingPKCS1SHANumber; @@ -361,35 +488,51 @@ - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(uint32_t) @implementation JWTAlgorithmRSBase (Create) + (instancetype)algorithm256 { - JWTAlgorithmRSBaseTest *base = [JWTAlgorithmRSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; - base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256; - base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ - return CC_SHA256(data, len, hashBytes); - }; - base.name = @"RS256"; - return base; +// JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new]; +// base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; +// base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256; +// base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ +// return CC_SHA256(data, len, hashBytes); +// }; +// base.name = @"RS256"; +// return base; + return [JWTAlgorithmRS256 new]; } + (instancetype)algorithm384 { - JWTAlgorithmRSBaseTest *base = [JWTAlgorithmRSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA384_DIGEST_LENGTH; - base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA384; - base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ - return CC_SHA384(data, len, hashBytes); - }; - base.name = @"RS384"; - return base; +// JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new]; +// base.ccSHANumberDigestLength = CC_SHA384_DIGEST_LENGTH; +// base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA384; +// base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ +// return CC_SHA384(data, len, hashBytes); +// }; +// base.name = @"RS384"; +// return base; + return [JWTAlgorithmRS384 new]; } + (instancetype)algorithm512 { - JWTAlgorithmRSBaseTest *base = [JWTAlgorithmRSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA512_DIGEST_LENGTH; - base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA512; +// JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new]; +// base.ccSHANumberDigestLength = CC_SHA512_DIGEST_LENGTH; +// base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA512; +// base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ +// return CC_SHA512(data, len, hashBytes); +// }; +// base.name = @"RS512"; +// return base; + return [JWTAlgorithmRS512 new]; +} + ++ (instancetype)mutableAlgorithm { + JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new]; + base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; + + //set to something ok + //base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256; base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ - return CC_SHA512(data, len, hashBytes); + return CC_SHA256(data, len, hashBytes); }; - base.name = @"RS512"; + base.name = @"RS256"; return base; } diff --git a/Classes/Security/Security+MissingSymbols.h b/Classes/Security/Security+MissingSymbols.h deleted file mode 100644 index 1e4e3e34..00000000 --- a/Classes/Security/Security+MissingSymbols.h +++ /dev/null @@ -1,51 +0,0 @@ -#import -#import - -#if TARGET_OS_MAC && !TARGET_OS_IPHONE -/** - These symbols are available in the iOS 9.3 SDK and marked as "available in Mac OS X - 10.7 and later", but are unavailable in the Mac headers for unknown reasons. They are - available in the binary, so adding their symbols like this both compiles and links - without issue. - */ -extern OSStatus SecKeyRawVerify( - SecKeyRef key, - SecPadding padding, - const uint8_t *signedData, - size_t signedDataLen, - const uint8_t *sig, - size_t sigLen) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_2_0); - -extern OSStatus SecKeyRawSign( - SecKeyRef key, - SecPadding padding, - const uint8_t *dataToSign, - size_t dataToSignLen, - uint8_t *sig, - size_t *sigLen) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_2_0); - - -enum { - /* For SecKeyRawSign/SecKeyRawVerify only, data to be signed is a SHA224 - hash; standard ASN.1 padding will be done, as well as PKCS1 padding - of the underlying RSA operation. */ - kSecPaddingPKCS1SHA224 = 0x8003, - - /* For SecKeyRawSign/SecKeyRawVerify only, data to be signed is a SHA256 - hash; standard ASN.1 padding will be done, as well as PKCS1 padding - of the underlying RSA operation. */ - kSecPaddingPKCS1SHA256 = 0x8004, - - /* For SecKeyRawSign/SecKeyRawVerify only, data to be signed is a SHA384 - hash; standard ASN.1 padding will be done, as well as PKCS1 padding - of the underlying RSA operation. */ - kSecPaddingPKCS1SHA384 = 0x8005, - - /* For SecKeyRawSign/SecKeyRawVerify only, data to be signed is a SHA512 - hash; standard ASN.1 padding will be done, as well as PKCS1 padding - of the underlying RSA operation. */ - kSecPaddingPKCS1SHA512 = 0x8006 -}; -#endif \ No newline at end of file From aaa4a46ee047ea3151f57243df2e1c227bf65e2c Mon Sep 17 00:00:00 2001 From: Lobanov Dmitry Date: Mon, 29 Aug 2016 14:36:00 +0300 Subject: [PATCH 2/5] algorithms: hs refactoring started. --- .../Algorithms/HSFamily/JWTAlgorithmHSBase.m | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/Classes/Algorithms/HSFamily/JWTAlgorithmHSBase.m b/Classes/Algorithms/HSFamily/JWTAlgorithmHSBase.m index 864edf1f..20f4a36a 100644 --- a/Classes/Algorithms/HSFamily/JWTAlgorithmHSBase.m +++ b/Classes/Algorithms/HSFamily/JWTAlgorithmHSBase.m @@ -10,7 +10,13 @@ #import #import #import +#import "JWTAlgorithmHS256.h" +#import "JWTAlgorithmHS384.h" +#import "JWTAlgorithmHS512.h" +// TODO: +// 1. hide algorithms as it was done in RSBase. +// 2. remove remain headers. @interface JWTAlgorithmHSBase () @end @@ -79,14 +85,18 @@ - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature @end +@interface JWTAlgorithmHSFamilyMember : JWTAlgorithmHSBase @end +@implementation JWTAlgorithmHSFamilyMember @end -@interface JWTAlgorithmHSBaseTest : JWTAlgorithmHSBase +/* JWTAlgorithmHS256 : JWTAlgorithmHSFamilyMember and others */ + +@interface JWTAlgorithmHSFamilyMemberMutable : JWTAlgorithmHSFamilyMember @property (assign, nonatomic, readwrite) size_t ccSHANumberDigestLength; @property (assign, nonatomic, readwrite) uint32_t ccHmacAlgSHANumber; @property (copy, nonatomic, readwrite) NSString *name; @end -@implementation JWTAlgorithmHSBaseTest +@implementation JWTAlgorithmHSFamilyMemberMutable @synthesize ccSHANumberDigestLength = _ccSHANumberDigestLength; @synthesize ccHmacAlgSHANumber = _ccHmacAlgSHANumber; @@ -105,27 +115,30 @@ - (uint32_t)ccHmacAlgSHANumber { @implementation JWTAlgorithmHSBase (Create) + (instancetype)algorithm256 { - JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; - base.ccHmacAlgSHANumber = kCCHmacAlgSHA256; - base.name = @"HS256"; - return base; +// JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; +// base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; +// base.ccHmacAlgSHANumber = kCCHmacAlgSHA256; +// base.name = @"HS256"; +// return base; + return [JWTAlgorithmHS256 new]; } + (instancetype)algorithm384 { - JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA384_DIGEST_LENGTH; - base.ccHmacAlgSHANumber = kCCHmacAlgSHA384; - base.name = @"HS384"; - return base; +// JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; +// base.ccSHANumberDigestLength = CC_SHA384_DIGEST_LENGTH; +// base.ccHmacAlgSHANumber = kCCHmacAlgSHA384; +// base.name = @"HS384"; +// return base; + return [JWTAlgorithmHS384 new]; } + (instancetype)algorithm512 { - JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; - base.ccSHANumberDigestLength = CC_SHA512_DIGEST_LENGTH; - base.ccHmacAlgSHANumber = kCCHmacAlgSHA512; - base.name = @"HS512"; - return base; +// JWTAlgorithmHSBaseTest *base = [JWTAlgorithmHSBaseTest new]; +// base.ccSHANumberDigestLength = CC_SHA512_DIGEST_LENGTH; +// base.ccHmacAlgSHANumber = kCCHmacAlgSHA512; +// base.name = @"HS512"; +// return base; + return [JWTAlgorithmHS512 new]; } @end From fc044675c1612d5637e613593666a9c0ee418d4a Mon Sep 17 00:00:00 2001 From: Lobanov Dmitry Date: Mon, 29 Aug 2016 14:38:03 +0300 Subject: [PATCH 3/5] podspec: version updated. --- JWT.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JWT.podspec b/JWT.podspec index 65f328b7..da4cd624 100644 --- a/JWT.podspec +++ b/JWT.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'JWT' - s.version = '2.1.0-beta.1' + s.version = '2.1.0-beta.3' s.summary = 'A JSON Web Token implementation in Objective-C.' s.homepage = 'https://github.com/yourkarma/jwt' s.license = { :type => 'MIT', :file => 'LICENSE' } From a628f296b9fe54f5ffacc88b29a19401e2b48285 Mon Sep 17 00:00:00 2001 From: Lobanov Dmitry Date: Mon, 29 Aug 2016 14:56:56 +0300 Subject: [PATCH 4/5] framework: missing files removed. --- Framework/JWT.xcodeproj/project.pbxproj | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/Framework/JWT.xcodeproj/project.pbxproj b/Framework/JWT.xcodeproj/project.pbxproj index b4c7380d..ed2666b3 100644 --- a/Framework/JWT.xcodeproj/project.pbxproj +++ b/Framework/JWT.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 045146AF1D5E2B1B007B1D7A /* JWTAlgorithmHS512.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145EF1D5E243D007B1D7A /* JWTAlgorithmHS512.m */; }; 045146B11D5E2B1B007B1D7A /* JWTAlgorithmHSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F11D5E243D007B1D7A /* JWTAlgorithmHSBase.m */; }; 045146B31D5E2B1B007B1D7A /* JWTAlgorithmHSFamily.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F31D5E243D007B1D7A /* JWTAlgorithmHSFamily.m */; }; - 045146B51D5E2B1B007B1D7A /* JWTAlgorithmRS256.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F61D5E243D007B1D7A /* JWTAlgorithmRS256.m */; }; 045146B71D5E2B1B007B1D7A /* JWTAlgorithmRSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F81D5E243D007B1D7A /* JWTAlgorithmRSBase.m */; }; 045146BA1D5E2B1B007B1D7A /* JWTClaim.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FC1D5E243D007B1D7A /* JWTClaim.m */; }; 045146BC1D5E2B1B007B1D7A /* JWTClaimsSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FE1D5E243D007B1D7A /* JWTClaimsSet.m */; }; @@ -32,7 +31,6 @@ 045146CD1D5E2B7A007B1D7A /* JWTAlgorithmHS512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145EE1D5E243D007B1D7A /* JWTAlgorithmHS512.h */; }; 045146CF1D5E2B7A007B1D7A /* JWTAlgorithmHSBase.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145F01D5E243D007B1D7A /* JWTAlgorithmHSBase.h */; }; 045146D11D5E2B7A007B1D7A /* JWTAlgorithmHSFamily.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145F21D5E243D007B1D7A /* JWTAlgorithmHSFamily.h */; }; - 045146D31D5E2B7A007B1D7A /* JWTAlgorithmRS256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145F51D5E243D007B1D7A /* JWTAlgorithmRS256.h */; }; 045146D51D5E2B7A007B1D7A /* JWTAlgorithmRSBase.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145F71D5E243D007B1D7A /* JWTAlgorithmRSBase.h */; }; 045146D71D5E2B7A007B1D7A /* JWTRSAlgorithm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145F91D5E243D007B1D7A /* JWTRSAlgorithm.h */; }; 045146D81D5E2B7A007B1D7A /* JWTClaim.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145FB1D5E243D007B1D7A /* JWTClaim.h */; }; @@ -40,7 +38,6 @@ 045146DC1D5E2B7A007B1D7A /* JWTClaimsSetSerializer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045145FF1D5E243D007B1D7A /* JWTClaimsSetSerializer.h */; }; 045146DE1D5E2B7A007B1D7A /* JWTClaimsSetVerifier.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045146011D5E243D007B1D7A /* JWTClaimsSetVerifier.h */; }; 045146E11D5E2B7A007B1D7A /* JWT.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045146041D5E243D007B1D7A /* JWT.h */; }; - 045146E31D5E2B7A007B1D7A /* Security+MissingSymbols.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 045146071D5E243D007B1D7A /* Security+MissingSymbols.h */; }; 045146E61D5E2C1B007B1D7A /* JWTAlgorithmFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145E61D5E243D007B1D7A /* JWTAlgorithmFactory.m */; }; 045146E81D5E2C1B007B1D7A /* JWTAlgorithmNone.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145E81D5E243D007B1D7A /* JWTAlgorithmNone.m */; }; 045146EA1D5E2C1B007B1D7A /* JWTAlgorithmHS256.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145EB1D5E243D007B1D7A /* JWTAlgorithmHS256.m */; }; @@ -48,7 +45,6 @@ 045146EE1D5E2C1B007B1D7A /* JWTAlgorithmHS512.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145EF1D5E243D007B1D7A /* JWTAlgorithmHS512.m */; }; 045146F01D5E2C1B007B1D7A /* JWTAlgorithmHSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F11D5E243D007B1D7A /* JWTAlgorithmHSBase.m */; }; 045146F21D5E2C1B007B1D7A /* JWTAlgorithmHSFamily.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F31D5E243D007B1D7A /* JWTAlgorithmHSFamily.m */; }; - 045146F41D5E2C1B007B1D7A /* JWTAlgorithmRS256.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F61D5E243D007B1D7A /* JWTAlgorithmRS256.m */; }; 045146F61D5E2C1B007B1D7A /* JWTAlgorithmRSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F81D5E243D007B1D7A /* JWTAlgorithmRSBase.m */; }; 045146F91D5E2C1B007B1D7A /* JWTClaim.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FC1D5E243D007B1D7A /* JWTClaim.m */; }; 045146FB1D5E2C1B007B1D7A /* JWTClaimsSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FE1D5E243D007B1D7A /* JWTClaimsSet.m */; }; @@ -63,7 +59,6 @@ 0451470D1D5E2C2B007B1D7A /* JWTAlgorithmHS512.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145EE1D5E243D007B1D7A /* JWTAlgorithmHS512.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0451470F1D5E2C2B007B1D7A /* JWTAlgorithmHSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F01D5E243D007B1D7A /* JWTAlgorithmHSBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 045147111D5E2C2B007B1D7A /* JWTAlgorithmHSFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F21D5E243D007B1D7A /* JWTAlgorithmHSFamily.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 045147131D5E2C2B007B1D7A /* JWTAlgorithmRS256.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F51D5E243D007B1D7A /* JWTAlgorithmRS256.h */; settings = {ATTRIBUTES = (Public, ); }; }; 045147151D5E2C2B007B1D7A /* JWTAlgorithmRSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F71D5E243D007B1D7A /* JWTAlgorithmRSBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 045147171D5E2C2B007B1D7A /* JWTRSAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F91D5E243D007B1D7A /* JWTRSAlgorithm.h */; settings = {ATTRIBUTES = (Public, ); }; }; 045147181D5E2C2B007B1D7A /* JWTClaim.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145FB1D5E243D007B1D7A /* JWTClaim.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -71,7 +66,6 @@ 0451471C1D5E2C2B007B1D7A /* JWTClaimsSetSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145FF1D5E243D007B1D7A /* JWTClaimsSetSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0451471E1D5E2C2B007B1D7A /* JWTClaimsSetVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146011D5E243D007B1D7A /* JWTClaimsSetVerifier.h */; settings = {ATTRIBUTES = (Public, ); }; }; 045147211D5E2C2B007B1D7A /* JWT.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146041D5E243D007B1D7A /* JWT.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 045147231D5E2C2B007B1D7A /* Security+MissingSymbols.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146071D5E243D007B1D7A /* Security+MissingSymbols.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005221D70639E001CBDE7 /* JWTAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145E41D5E243D007B1D7A /* JWTAlgorithm.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005231D70639E001CBDE7 /* JWTAlgorithmFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145E51D5E243D007B1D7A /* JWTAlgorithmFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005241D70639E001CBDE7 /* JWTAlgorithmNone.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145E71D5E243D007B1D7A /* JWTAlgorithmNone.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -80,7 +74,6 @@ 04C005271D70639E001CBDE7 /* JWTAlgorithmHS512.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145EE1D5E243D007B1D7A /* JWTAlgorithmHS512.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005281D70639E001CBDE7 /* JWTAlgorithmHSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F01D5E243D007B1D7A /* JWTAlgorithmHSBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005291D70639E001CBDE7 /* JWTAlgorithmHSFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F21D5E243D007B1D7A /* JWTAlgorithmHSFamily.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 04C0052A1D70639E001CBDE7 /* JWTAlgorithmRS256.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F51D5E243D007B1D7A /* JWTAlgorithmRS256.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C0052B1D70639E001CBDE7 /* JWTAlgorithmRSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F71D5E243D007B1D7A /* JWTAlgorithmRSBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C0052C1D70639E001CBDE7 /* JWTRSAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145F91D5E243D007B1D7A /* JWTRSAlgorithm.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C0052D1D70639E001CBDE7 /* JWTClaim.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145FB1D5E243D007B1D7A /* JWTClaim.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -88,7 +81,6 @@ 04C0052F1D70639E001CBDE7 /* JWTClaimsSetSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 045145FF1D5E243D007B1D7A /* JWTClaimsSetSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005301D70639E001CBDE7 /* JWTClaimsSetVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146011D5E243D007B1D7A /* JWTClaimsSetVerifier.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005311D70639E001CBDE7 /* JWT.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146041D5E243D007B1D7A /* JWT.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 04C005321D70639E001CBDE7 /* Security+MissingSymbols.h in Headers */ = {isa = PBXBuildFile; fileRef = 045146071D5E243D007B1D7A /* Security+MissingSymbols.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04C005331D7063C8001CBDE7 /* JWTAlgorithmFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145E61D5E243D007B1D7A /* JWTAlgorithmFactory.m */; }; 04C005341D7063C8001CBDE7 /* JWTAlgorithmNone.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145E81D5E243D007B1D7A /* JWTAlgorithmNone.m */; }; 04C005351D7063C8001CBDE7 /* JWTAlgorithmHS256.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145EB1D5E243D007B1D7A /* JWTAlgorithmHS256.m */; }; @@ -96,7 +88,6 @@ 04C005371D7063C8001CBDE7 /* JWTAlgorithmHS512.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145EF1D5E243D007B1D7A /* JWTAlgorithmHS512.m */; }; 04C005381D7063C8001CBDE7 /* JWTAlgorithmHSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F11D5E243D007B1D7A /* JWTAlgorithmHSBase.m */; }; 04C005391D7063C8001CBDE7 /* JWTAlgorithmHSFamily.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F31D5E243D007B1D7A /* JWTAlgorithmHSFamily.m */; }; - 04C0053A1D7063C8001CBDE7 /* JWTAlgorithmRS256.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F61D5E243D007B1D7A /* JWTAlgorithmRS256.m */; }; 04C0053B1D7063C8001CBDE7 /* JWTAlgorithmRSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145F81D5E243D007B1D7A /* JWTAlgorithmRSBase.m */; }; 04C0053C1D7063C8001CBDE7 /* JWTClaim.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FC1D5E243D007B1D7A /* JWTClaim.m */; }; 04C0053D1D7063C8001CBDE7 /* JWTClaimsSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 045145FE1D5E243D007B1D7A /* JWTClaimsSet.m */; }; @@ -142,7 +133,6 @@ 045146CD1D5E2B7A007B1D7A /* JWTAlgorithmHS512.h in CopyFiles */, 045146CF1D5E2B7A007B1D7A /* JWTAlgorithmHSBase.h in CopyFiles */, 045146D11D5E2B7A007B1D7A /* JWTAlgorithmHSFamily.h in CopyFiles */, - 045146D31D5E2B7A007B1D7A /* JWTAlgorithmRS256.h in CopyFiles */, 045146D51D5E2B7A007B1D7A /* JWTAlgorithmRSBase.h in CopyFiles */, 045146D71D5E2B7A007B1D7A /* JWTRSAlgorithm.h in CopyFiles */, 045146D81D5E2B7A007B1D7A /* JWTClaim.h in CopyFiles */, @@ -150,7 +140,6 @@ 045146DC1D5E2B7A007B1D7A /* JWTClaimsSetSerializer.h in CopyFiles */, 045146DE1D5E2B7A007B1D7A /* JWTClaimsSetVerifier.h in CopyFiles */, 045146E11D5E2B7A007B1D7A /* JWT.h in CopyFiles */, - 045146E31D5E2B7A007B1D7A /* Security+MissingSymbols.h in CopyFiles */, 0451466B1D5E2A78007B1D7A /* JWT_iOS_Static.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; @@ -173,8 +162,6 @@ 045145F11D5E243D007B1D7A /* JWTAlgorithmHSBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmHSBase.m; sourceTree = ""; }; 045145F21D5E243D007B1D7A /* JWTAlgorithmHSFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmHSFamily.h; sourceTree = ""; }; 045145F31D5E243D007B1D7A /* JWTAlgorithmHSFamily.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmHSFamily.m; sourceTree = ""; }; - 045145F51D5E243D007B1D7A /* JWTAlgorithmRS256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmRS256.h; sourceTree = ""; }; - 045145F61D5E243D007B1D7A /* JWTAlgorithmRS256.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmRS256.m; sourceTree = ""; }; 045145F71D5E243D007B1D7A /* JWTAlgorithmRSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmRSBase.h; sourceTree = ""; }; 045145F81D5E243D007B1D7A /* JWTAlgorithmRSBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmRSBase.m; sourceTree = ""; }; 045145F91D5E243D007B1D7A /* JWTRSAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTRSAlgorithm.h; sourceTree = ""; }; @@ -188,7 +175,6 @@ 045146021D5E243D007B1D7A /* JWTClaimsSetVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTClaimsSetVerifier.m; sourceTree = ""; }; 045146041D5E243D007B1D7A /* JWT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWT.h; sourceTree = ""; }; 045146051D5E243D007B1D7A /* JWT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWT.m; sourceTree = ""; }; - 045146071D5E243D007B1D7A /* Security+MissingSymbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Security+MissingSymbols.h"; sourceTree = ""; }; 045146681D5E2A78007B1D7A /* libJWT_iOS_Static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libJWT_iOS_Static.a; sourceTree = BUILT_PRODUCTS_DIR; }; 0451466A1D5E2A78007B1D7A /* JWT_iOS_Static.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JWT_iOS_Static.h; sourceTree = ""; }; 0451466C1D5E2A78007B1D7A /* JWT_iOS_Static.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JWT_iOS_Static.m; sourceTree = ""; }; @@ -327,8 +313,6 @@ 045145F41D5E243D007B1D7A /* RSFamily */ = { isa = PBXGroup; children = ( - 045145F51D5E243D007B1D7A /* JWTAlgorithmRS256.h */, - 045145F61D5E243D007B1D7A /* JWTAlgorithmRS256.m */, 045145F71D5E243D007B1D7A /* JWTAlgorithmRSBase.h */, 045145F81D5E243D007B1D7A /* JWTAlgorithmRSBase.m */, 045145F91D5E243D007B1D7A /* JWTRSAlgorithm.h */, @@ -354,7 +338,6 @@ 045146061D5E243D007B1D7A /* Security */ = { isa = PBXGroup; children = ( - 045146071D5E243D007B1D7A /* Security+MissingSymbols.h */, ); path = Security; sourceTree = ""; @@ -482,7 +465,6 @@ 0451470D1D5E2C2B007B1D7A /* JWTAlgorithmHS512.h in Headers */, 0451470F1D5E2C2B007B1D7A /* JWTAlgorithmHSBase.h in Headers */, 045147111D5E2C2B007B1D7A /* JWTAlgorithmHSFamily.h in Headers */, - 045147131D5E2C2B007B1D7A /* JWTAlgorithmRS256.h in Headers */, 045147151D5E2C2B007B1D7A /* JWTAlgorithmRSBase.h in Headers */, 045147171D5E2C2B007B1D7A /* JWTRSAlgorithm.h in Headers */, 045147181D5E2C2B007B1D7A /* JWTClaim.h in Headers */, @@ -490,7 +472,6 @@ 0451471C1D5E2C2B007B1D7A /* JWTClaimsSetSerializer.h in Headers */, 0451471E1D5E2C2B007B1D7A /* JWTClaimsSetVerifier.h in Headers */, 045147211D5E2C2B007B1D7A /* JWT.h in Headers */, - 045147231D5E2C2B007B1D7A /* Security+MissingSymbols.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -514,7 +495,6 @@ 04C005271D70639E001CBDE7 /* JWTAlgorithmHS512.h in Headers */, 04C005281D70639E001CBDE7 /* JWTAlgorithmHSBase.h in Headers */, 04C005291D70639E001CBDE7 /* JWTAlgorithmHSFamily.h in Headers */, - 04C0052A1D70639E001CBDE7 /* JWTAlgorithmRS256.h in Headers */, 04C0052B1D70639E001CBDE7 /* JWTAlgorithmRSBase.h in Headers */, 04C0052C1D70639E001CBDE7 /* JWTRSAlgorithm.h in Headers */, 04C0052D1D70639E001CBDE7 /* JWTClaim.h in Headers */, @@ -522,7 +502,6 @@ 04C0052F1D70639E001CBDE7 /* JWTClaimsSetSerializer.h in Headers */, 04C005301D70639E001CBDE7 /* JWTClaimsSetVerifier.h in Headers */, 04C005311D70639E001CBDE7 /* JWT.h in Headers */, - 04C005321D70639E001CBDE7 /* Security+MissingSymbols.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -881,7 +860,6 @@ 045146AF1D5E2B1B007B1D7A /* JWTAlgorithmHS512.m in Sources */, 045146B11D5E2B1B007B1D7A /* JWTAlgorithmHSBase.m in Sources */, 045146B31D5E2B1B007B1D7A /* JWTAlgorithmHSFamily.m in Sources */, - 045146B51D5E2B1B007B1D7A /* JWTAlgorithmRS256.m in Sources */, 045146B71D5E2B1B007B1D7A /* JWTAlgorithmRSBase.m in Sources */, 045146BA1D5E2B1B007B1D7A /* JWTClaim.m in Sources */, 045146BC1D5E2B1B007B1D7A /* JWTClaimsSet.m in Sources */, @@ -903,7 +881,6 @@ 045146EE1D5E2C1B007B1D7A /* JWTAlgorithmHS512.m in Sources */, 045146F01D5E2C1B007B1D7A /* JWTAlgorithmHSBase.m in Sources */, 045146F21D5E2C1B007B1D7A /* JWTAlgorithmHSFamily.m in Sources */, - 045146F41D5E2C1B007B1D7A /* JWTAlgorithmRS256.m in Sources */, 045146F61D5E2C1B007B1D7A /* JWTAlgorithmRSBase.m in Sources */, 045146F91D5E2C1B007B1D7A /* JWTClaim.m in Sources */, 045146FB1D5E2C1B007B1D7A /* JWTClaimsSet.m in Sources */, @@ -931,7 +908,6 @@ 04C005371D7063C8001CBDE7 /* JWTAlgorithmHS512.m in Sources */, 04C005381D7063C8001CBDE7 /* JWTAlgorithmHSBase.m in Sources */, 04C005391D7063C8001CBDE7 /* JWTAlgorithmHSFamily.m in Sources */, - 04C0053A1D7063C8001CBDE7 /* JWTAlgorithmRS256.m in Sources */, 04C0053B1D7063C8001CBDE7 /* JWTAlgorithmRSBase.m in Sources */, 04C0053C1D7063C8001CBDE7 /* JWTClaim.m in Sources */, 04C0053D1D7063C8001CBDE7 /* JWTClaimsSet.m in Sources */, From 71e3d0af58631962702b62a4307799a869a143bc Mon Sep 17 00:00:00 2001 From: Lobanov Dmitry Date: Mon, 29 Aug 2016 15:11:01 +0300 Subject: [PATCH 5/5] algorithms: rs algorithms cleanup. --- Framework/JWT.xcodeproj/project.pbxproj | 8 -------- Tests/Podfile.lock | 4 ++-- Tests/Tests/Algorithms/JWTAlgorithmRS256Tests.m | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Framework/JWT.xcodeproj/project.pbxproj b/Framework/JWT.xcodeproj/project.pbxproj index ed2666b3..e188ff59 100644 --- a/Framework/JWT.xcodeproj/project.pbxproj +++ b/Framework/JWT.xcodeproj/project.pbxproj @@ -265,7 +265,6 @@ 045145FA1D5E243D007B1D7A /* ClaimSet */, 045146041D5E243D007B1D7A /* JWT.h */, 045146051D5E243D007B1D7A /* JWT.m */, - 045146061D5E243D007B1D7A /* Security */, ); name = Classes; path = ../Classes; @@ -335,13 +334,6 @@ path = ClaimSet; sourceTree = ""; }; - 045146061D5E243D007B1D7A /* Security */ = { - isa = PBXGroup; - children = ( - ); - path = Security; - sourceTree = ""; - }; 045146691D5E2A78007B1D7A /* JWT_iOS_Static */ = { isa = PBXGroup; children = ( diff --git a/Tests/Podfile.lock b/Tests/Podfile.lock index f1840c4b..28afd593 100644 --- a/Tests/Podfile.lock +++ b/Tests/Podfile.lock @@ -1,6 +1,6 @@ PODS: - Base64 (1.1.2) - - JWT (2.1.0-beta.1): + - JWT (2.1.0-beta.3): - Base64 (~> 1.1.2) - Kiwi (2.4.0) @@ -14,7 +14,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Base64: cecfb41a004124895a7bcee567a89bae5a89d49b - JWT: 65a6027bb6c7cd91730b7add2e1654458e314b80 + JWT: c21ea91b77009bc59374a09f0a78b57e063da980 Kiwi: f49c9d54b28917df5928fe44968a39ed198cb8a8 PODFILE CHECKSUM: ff7603a55b6a1be7ba8ea4473ecf3ce38d656d06 diff --git a/Tests/Tests/Algorithms/JWTAlgorithmRS256Tests.m b/Tests/Tests/Algorithms/JWTAlgorithmRS256Tests.m index b8f52393..9360c868 100644 --- a/Tests/Tests/Algorithms/JWTAlgorithmRS256Tests.m +++ b/Tests/Tests/Algorithms/JWTAlgorithmRS256Tests.m @@ -9,7 +9,6 @@ #import #import #import "JWT.h" -#import "JWTAlgorithmRS256.h" #import "JWTAlgorithmRSBase.h" static NSString *algorithmBehavior = @"algorithmRS256Behaviour";