Can't login with logical account

I am getting error 58289 whenever I try to log in to a logical account using the following syntax:
$cred = Get-Credential
New-PWLogin -DatasourceName <my data source> -UserName TheUser -Password $cred.Password

At first, I thought that I was doing the encryption/decription incorrectly, so I demonstrated the problem using the secure string directly (as above).  This code works fine on my development machine, but it gives me error 58289 when I run it from the server. I get the same results using Save-SecureStringToEncryptedFile and Get-SecureStringFromEncryptedFile .  This was working at some point and I'm not sure when it stopped working.  Any ideas?