Skip to content

Commit 83fb612

Browse files
author
David Benko
committed
constantize RSA key length
1 parent 42e0b9c commit 83fb612

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ObjectiveTLS/ObjectiveTLS.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ @interface ObjectiveTLS (){
2424
@end
2525

2626
@implementation ObjectiveTLS
27-
27+
static const NSUInteger kRSAKeySize = 1024; //Bit
2828
static const CCAlgorithm kAlgorithm = kCCAlgorithmAES128;
2929
static const NSUInteger kAlgorithmKeySize = kCCKeySizeAES128;
3030
static const NSUInteger kAlgorithmBlockSize = kCCBlockSizeAES128;
@@ -129,7 +129,7 @@ - (NSData *) RSAEncryptData:(NSData *)content {
129129
[content getBytes:plain
130130
length:plainLen];
131131

132-
size_t cipherLen = 128; // currently RSA key length is set to 128 bytes
132+
size_t cipherLen = (kRSAKeySize / 8); // convert to byte
133133
void *cipher = malloc(cipherLen);
134134

135135
OSStatus returnCode = SecKeyEncrypt(publicKey, kSecPaddingPKCS1, plain,
@@ -304,4 +304,4 @@ - (void)dealloc {
304304
CFRelease(trust),trust=nil;
305305
}
306306

307-
@end
307+
@end

0 commit comments

Comments
 (0)