'ConvertTo-SecureString : Capacity Exceeds maximum capacity, encrypt file seems to has max length

Using ConvertTo-SecureString to encrypt an 1MB file and decrypt it, decrypt file size is only 65KB.

Error Message

ConvertTo-SecureString : Capacity Exceeds maximum capacity.
Parameter name: capacity.
At XXX

So I think that there is a maximum capacity limited for ConvertTo-SecureString, so there are 2 questions:

  1. How long can ConvertTo-SecureString Encrypt?
  2. How to Encrypt a file over 1MB to a securestring file?


Solution 1:[1]

Duplicate string smaller than 65536 length, encrypt it.

And decrypt it one by one solve.

Solution 2:[2]

Yo can do like that :

let root = document.documentElement;

function moving() {
  root.style.setProperty('--pose-y', "150px");
  root.style.setProperty('--pose-x', "150px");
}
:root {
--pose-x: 100px;
--pose-y: 0px;
}

.item {
left: var(--pose-x);
top: var(--pose-y);
width: 50px;
height: 50px;
background: blue;
position: fixed;
transition: all 0.5s cubic-bezier(0.49, -0.29, 0.75, 0.41);
}
<div class="item"></div>
<button onclick="moving()">Click here</button>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 parallelbgls
Solution 2 Liam-Nothing