Read Windows Credentials From R

157 Views Asked by At

I have a couple of windows credentials stored using the Windows credentials manager:

Screenshot of windows credential manager

I would like to retrieve some passwords via R and I am using the oskeyring package for doing so:

library(oskeyring)

(my_cred <- windows_item_read("my_service", "domain_password"))
# <oskeyring_windows_item: domain_password>
#  target_name: my_service
#  persist: enterprise
#  username: my_user_name
#  credential_blob: <-- hidden -->

However, if I try to return the password I only get raw(0):

my_cred$credential_blob
# raw(0)

How to get the password? (I also tried keyring but with it I can only access/modify the password stored under label Generic Credentials)

1

There are 1 best solutions below

1
Arthur On

I can get Windows Credential Manager to work with keyring with this configuration of a Generic Credential.

I put a colon : before and after the service and the user, i.e. :address3:user3. I add the user name also to the User name: field. And I type the password into the Password field.

enter image description here

In R,

> library(keyring)
> key_get("address3", "user3")
[1] "password3"
> 

I wish I could offer insight on why this works, but I don't know! I inherited this method from a coworker years ago :)