Crypt backend, and path lengths

This is not a question but an FYI for those using the crypt backend.

For cloud vendors like Onedrive that have a limit on the maximum path length (not filename), when using the crypt backend, keep in mind these two:

  1. each segment of the path needs to be encrypted separately (for obvious reasons)
  2. From: https://rclone.org/crypt/ "File segments are padded using PKCS#7 to a multiple of 16 bytes before encryption."

This means that if your pathname includes a lot of components that close to a multiple of 16, but greater than it, your encrypted pathname will be way longer than that unencrypted pathname. 1-char, 17-char, 33-char etc. are the worst case scenario. Eg:

$ rclone backend encode crypted: "/a/b/c/d/e/f/g/h" | wc -c
217
$ rclone backend encode crytped: "/abcdefgh" | wc -c
28
$ rclone backend encode crypted: "/aaaaaaaaaaaaaaa/bbbbbbbbbbbbbbb/cccccccc/dddddddd/e/f/g/h" | wc -c
217

This all makes perfect sense. Just pointing it out to save others the trouble of tripping up on it.

See Max path length for Onedrive + crypt for more info.

3 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.