Problem with encrypted files
Hi,
I have problem with owncloud encryption modules, in fact i have lot of file encrypted and i cannot open it.
I have this error when my client try to sync and when i try with internet Browser return error 500
Thanks for your help
Sync client logs
20/07/2015 11:19:36PO SAGE.xmind ownCloud Cet élément n'a pas été synchronisé en raison des erreurs précédentes : Error downloading http://192.168.1.169/remote.php/webdav/PO SAGE.xmind - server replied: Service Unavailable
20/07/2015 11:19:36PBE/CBEMA/Grille_atelier_salle1.odt ownCloud Operation canceled12 Kio
20/07/2015 11:19:36PBE/CBEMA/Diaporama-séminaire-PBE-30juin2014.pdf ownCloud Operation canceled3 Mio
20/07/2015 11:19:36PBE/CBEMA/Diaporama-GEMAPI-seminaire-PBE-30juin2014.pdf ownCloud Connexion fermée110 Kio
20/07/2015 11:19:36Fil-ariane.ott ownCloud Cet élément n'a pas été synchronisé en raison des erreurs précédentes : Error downloading http://192.168.1.169/remote.php/webdav/Fil-ariane.ott - server replied: Service Unavailable
20/07/2015 11:19:36CR-modele.ott ownCloud Cet élément n'a pas été synchronisé en raison des erreurs précédentes : Error downloading http://192.168.1.169/remote.php/webdav/CR-modele.ott - server replied: Service Unavailable
20/07/2015 11:19:33PBE/CODIR EAU/CODIR Eau 2014-12-17 CR.doc ownCloud Operation canceled61 Kio
20/07/2015 11:19:33PBE/CODIR EAU/CODIR EAU-2014-11-26-OJ.odt ownCloud Operation canceled23 Kio
20/07/2015 11:19:33PBE/CBEMA/Grille_atelier_salle2.odt ownCloud Operation canceled12 Kio
20/07/2015 11:19:33PBE/CBEMA/Grille_atelier_salle1.odt ownCloud Operation canceled12 Kio
20/07/2015 11:19:33PBE/CBEMA/Diaporama-séminaire-PBE-30juin2014.pdf ownCloud Operation canceled3 Mio
20/07/2015 11:19:33PBE/CBEMA/Diaporama-GEMAPI-seminaire-PBE-30juin2014.pdf ownCloud Connexion fermée110 Kio
20/07/2015 11:19:29PBE/CBEMA/Grille_atelier_salle1.odt ownCloud Operation canceled12 Kio
20/07/2015 11:19:29PBE/CBEMA/Diaporama-séminaire-PBE-30juin2014.pdf ownCloud Operation canceled3 Mio
Server configuration
Operating system: i running Linux owncloud 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux (Wheezy)
Web server: Apache/2.2.22 (Debian) Database: mysql Ver 14.14 Distrib 5.5.43, PHP version: PHP 5.4.41-0+deb7u1
ownCloud version: ownCloud 8.0.4 (stable) Updated from an older ownCloud or fresh install: Updated from last deb package List of activated apps: Enabled:
- adminuser
- files
- files_encryption
- files_pdfviewer
- files_sharing
- files_texteditor
- files_trashbin
- files_versions
- gallery
- user_external
- user_ldap
@schiesbn any advise?
I have found my Encryption key for my file here /var/www/owncloud/data/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E/encryption_migration_backup_2015-07-20_09-01-24/
But the private keys has not the same value.
And if i copy my old private key i have message say my that key are not initialised
How i can find solution ?
Hi i have working on my problem.
I am going to encryption_migration_backup for try tu decode private key.
I have use this method (source 1).
And after i try to make password field for try many password and if matching i can decode my file and it's working (source 2)
But i think something as changed with owncloud 7.1 and owncloud 8.0.4 because many files can be decrypted
i have tried this on one files and i decode my file And i get Cannot find header.
Can you help me for give me an initial response ?
Thanks a lot
'; // first get users private key and decrypt it $encryptedUserKey = file_get_contents('/var/www/owncloud/data/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E/encryption_migration_backup_2015-07-17_09-36-46/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E.privateKey'); $decryptedUserKey = OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedUserKey, $password); echo '1 :' . $encryptedUserKey; echo ''; echo '
'; echo '2 :' . $decryptedUserKey; echo '
'; echo '
'; // now we need to decrypt the file-key, therefore we use our private key and the share key $shareKey = file_get_contents('/var/www/owncloud/data/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E/encryption_migration_backup_2015-07-17_09-36-46/keys/PBE/Diaporama-GEMAPI-seminaire-PBE-30juin2014.pdf/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E.shareKey'); $encryptedKeyfile = file_get_contents('/var/www/owncloud/data/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E/encryption_migration_backup_2015-07-17_09-36-46/keys/PBE/Diaporama-GEMAPI-seminaire-PBE-30juin2014.pdf/fileKey'); echo '3 :' . $shareKey; echo '
'; echo '
'; echo '4 :' . $encryptedKeyfile; echo '
'; echo '
'; $decryptedKeyfile = OCA\Files_Encryption\Crypt::multiKeyDecrypt($encryptedKeyfile, $shareKey, $decryptedUserKey); // finally we can use the decrypted file-key to decrypt the file // but first, strip header block $handle = fopen('/var/www/owncloud/data/35E51C47-0ABB-4A3F-B9A2-E8401A25CD1E/files/PBE/CBEMA/Diaporama-GEMAPI-seminaire-PBE-30juin2014.pdf', 'r'); // if this block contained the header we move on to the next block $data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE); // if this block contained the header, we can continue if (OCA\Files_Encryption\Crypt::isHeader($data)) { $header = OCA\Files_Encryption\Crypt::parseHeader($data); $cipher = OCA\Files_Encryption\Crypt::getCipher($header); } else { die('Cannot find header'); } while ($data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE)) { // Decrypt the block $decryptedBlock = OCA\Files_Encryption\Crypt::symmetricDecryptFileContent($data, $decryptedKeyfile, $cipher); // A that point you can write the decrypted block to the decrypted file // instead of appending it to $decryptedContent. But I don't fear memory // limits and I choose to append the block to my string and write the // file at the end $decryptedContent .= $decryptedBlock; } fclose($handle); // Decrypt the content block by block ``` echo $decryptedContent; } ############# source 1 ############## '; echo '
'; echo '2 :' . $decryptedUserKey; echo '
'; echo '
'; // now we need to decrypt the file-key, therefore we use our private key and the share key $shareKey = file_get_contents($datadir . $username . '/test/keys/' . $filepath . '/' . $username . '.shareKey'); $encryptedKeyfile = file_get_contents($datadir . $username . '/test/keys/' . $filepath . '/fileKey'); echo '3 :' . $shareKey; echo '
'; echo '
'; echo '4 :' . $encryptedKeyfile; echo '
'; echo '
'; $decryptedKeyfile = OCA\Files_Encryption\Crypt::multiKeyDecrypt($encryptedKeyfile, $shareKey, $decryptedUserKey); // finally we can use the decrypted file-key to decrypt the file // but first, strip header block $handle = fopen($datadir . $username . '/files/' . $filepath, 'r'); $data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE); echo $data; echo '
'; echo OCA\Files_Encryption\Crypt::isHeader($data); // if this block contained the header we move on to the next block if (OCA\Files_Encryption\Crypt::isHeader($data)) { echo $data; $header = OCA\Files_Encryption\Crypt::parseHeader($data); echo $data; $cipher = OCA\Files_Encryption\Crypt::getCipher($header); } else { die('Cannot find header'); } // Decrypt the content block by block $decryptedContent = ''; while ($data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE)) { $decryptedContent .= OCA\Files_Encryption\Crypt::symmetricDecryptFileContent($data, $decryptedKeyfile, $cipher); } fclose($handle); ?>
######### end source 1 #################
######## begin source 2 #################
'; // first get users private key and decrypt it $encryptedUserKey = file_get_contents($datadir . $username . '/files_encryption/' . $username . '.privateKey'); $decryptedUserKey = OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedUserKey, $password); echo '1 :' . $encryptedUserKey; echo ''; echo '
'; echo '2 :' . $decryptedUserKey; echo '
'; echo '
'; // now we need to decrypt the file-key, therefore we use our private key and the share key $shareKey = file_get_contents($datadir . $username . '/files_encryption/keys/' . $filepath . '/' . $username . '.shareKey'); $encryptedKeyfile = file_get_contents($datadir . $username . '/files_encryption/keys/' . $filepath . '/fileKey'); echo '3 :' . $shareKey; echo '
'; echo '
'; echo '4 :' . $encryptedKeyfile; echo '
'; echo '
'; $decryptedKeyfile = OCA\Files_Encryption\Crypt::multiKeyDecrypt($encryptedKeyfile, $shareKey, $decryptedUserKey); // finally we can use the decrypted file-key to decrypt the file // but first, strip header block $handle = fopen($datadir . $username . '/files/' . $filepath, 'r'); // if this block contained the header we move on to the next block echo $data; $data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE); // if this block contained the header, we can continue if (OCA\Files_Encryption\Crypt::isHeader($data)) { $header = OCA\Files_Encryption\Crypt::parseHeader($data); $cipher = OCA\Files_Encryption\Crypt::getCipher($header); } else { die('Cannot find header'); } while ($data = fread($handle, OCA\Files_Encryption\Crypt::BLOCKSIZE)) { // Decrypt the block $decryptedBlock = OCA\Files_Encryption\Crypt::symmetricDecryptFileContent($data, $decryptedKeyfile, $cipher); // A that point you can write the decrypted block to the decrypted file // instead of appending it to $decryptedContent. But I don't fear memory // limits and I choose to append the block to my string and write the // file at the end $decryptedContent .= $decryptedBlock; } fclose($handle); // Decrypt the content block by block ``` echo $decryptedContent; } ?>
####################################
And when i open my file with notepad i dont have this HBEGIN:cipher:AES-256-CFB:HEND in the first line
Are you still having trouble, does this still happen in 8.2.2 ?
Closing due to lack of feedback.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.