Can't decrypt files

When use occ, we were able to partially decrypt the files, but a large number of files could not be restored.

We are trying to decrypt the file key and the file itself using the source code of the ownCloud service and the openssl library functions for php.

  1. We managed to get the user’s private key.

  2. When trying to decrypt filekey via function openssl_open using sharedkey
    0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error

  3. We also tried to use a bunch of functions

  • openssl_private_decrypt (to get the RC4 key)

  • openssl_decrypt (to decrypt filekey)

    However, we were not able to get the RC4 key, by a similar error
    0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error

For each file, we have recoverykey, but the method described above for obtaining filekey did not give us results, even when using master private key.

How to decrypt filekey using recovery key, openssl functions, class Crypt (from owncloud source files)?