Browse Source

fix filename pem

Marino Faggiana 7 years ago
parent
commit
0b7f15cae1
1 changed files with 6 additions and 6 deletions
  1. 6 6
      iOSClient/Security/NCEndToEndEncryption.m

+ 6 - 6
iOSClient/Security/NCEndToEndEncryption.m

@@ -187,31 +187,31 @@ cleanup:
 
 - (BOOL)savePEMWithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directoryUser:(NSString *)directoryUser
 {
-    NSString *certPath = [NSString stringWithFormat:@"%@/%@", directoryUser, fileNamePrivateKey];
-    NSString *keyPath = [NSString stringWithFormat:@"%@/%@", directoryUser, fileNameCertificate];
+    NSString *certificatePath = [NSString stringWithFormat:@"%@/%@", directoryUser, fileNameCertificate];
+    NSString *privatekeyPath = [NSString stringWithFormat:@"%@/%@", directoryUser, fileNamePrivateKey];
     NSString *csrPath = [NSString stringWithFormat:@"%@/%@", directoryUser, fileNameCSR];
     
     // Here you write the private key (pkey) to disk. OpenSSL will encrypt the
     // file using the password and cipher you provide.
     //if (PEM_write_PrivateKey(f, pkey, EVP_des_ede3_cbc(), (unsigned char *)[password UTF8String], (int)password.length, NULL, NULL) < 0) {
     
-    FILE *f = fopen([keyPath fileSystemRepresentation], "wb");
+    FILE *f = fopen([privatekeyPath fileSystemRepresentation], "wb");
     if (PEM_write_PrivateKey(f, pkey, NULL, NULL, 0, NULL, NULL) < 0) {
         // Error encrypting or writing to disk.
         fclose(f);
         return NO;
     }
-    NSLog(@"Saved key to %@", keyPath);
+    NSLog(@"Saved key to %@", privatekeyPath);
     fclose(f);
     
     // Here you write the certificate to the disk. No encryption is needed here since this is public facing information
-    f = fopen([certPath fileSystemRepresentation], "wb");
+    f = fopen([certificatePath fileSystemRepresentation], "wb");
     if (PEM_write_X509(f, x509) < 0) {
         // Error writing to disk.
         fclose(f);
         return NO;
     }
-    NSLog(@"Saved cert to %@", certPath);
+    NSLog(@"Saved cert to %@", certificatePath);
     fclose(f);
     
     // CSR Request sha256