diff --git a/NSData+CommonCrypto.m b/NSData+CommonCrypto.m index 47dbd3d..b0cd7fa 100644 --- a/NSData+CommonCrypto.m +++ b/NSData+CommonCrypto.m @@ -282,11 +282,11 @@ static void FixKeyLengths( CCAlgorithm algorithm, NSMutableData * keyData, NSMut { case kCCAlgorithmAES128: { - if ( keyLength < 16 ) + if ( keyLength <= 16 ) { [keyData setLength: 16]; } - else if ( keyLength < 24 ) + else if ( keyLength <= 24 ) { [keyData setLength: 24]; } @@ -543,4 +543,4 @@ - (NSData *) HMACWithAlgorithm: (CCHmacAlgorithm) algorithm key: (id) key return ( [NSData dataWithBytes: buf length: (algorithm == kCCHmacAlgMD5 ? CC_MD5_DIGEST_LENGTH : CC_SHA1_DIGEST_LENGTH)] ); } -@end \ No newline at end of file +@end