6.5

Table Of Contents
VMware, Inc. 63
Chapter B Credential Store Perl Library
vSphere Credential Store Subroutine Reference
TheViCredStorepackageincludesthefollowingsubroutines:
“init”onpage 63
“get_password”onpage 63
“add_password”onpage 64
“remove_password”onpage 64
“clear_passwords”onpage 64
“get_hosts”onpage 64
“get_usernames”onpage 64
“close”onpage 65
init
Initializesthecredentialstore.Callthissubroutineonce,beforeanyoftheothercredentialstoresubroutines.
Thecredentialstoreisnotcreateduntilyourprogramcallsadd_password.
Thissubroutineacceptsthelocationofthecredentialstorefile.Ifyoudonotprovideacredentialstorefilename
VICredStore::init()looksinthe
defaultlocation.
Linux:$HOME/.vmware/credstore/vicredentials.xml
Windows:%APPDATA%\VMware\credstore\vicredentials.xml
Ifnocredentialstoreexistsatthedefaultlocation,theinitializationprocess:
Checksthatthecredstoredirectoryexists,andcreatesoneifitdoesnot.
Createsthevicredentials.xmlfileandparentdirectory.
IfyouprovideanondefaultcredentialstorefilenametoVICredStore::init(),thecredentialstoreatthat
locationisused.Ifthereisnocredentialstoreatthatlocationandthedirectoryyouspecifyexists,the
initializationprocesscreatesthefile.Ifthedirectory
youspecifydoesnotexist,theinitializationprocessfails.
Parameters
Returns
Returns1ifinitializationissuccessful;otherwise,returns0.
get_password
Retrievesthepasswordforaspecifiedserverandusername.
Parameters
Returns
Returnsthepassword,orundefifnopasswordisfound.
Parameter Description
filename Nameofcredentialstorefile.
Parameter Description
server Serverforwhichyouwanttoretrievethepasswordforthespecifieduser.CanbeanESX/ESXi
orvCenterServersystem.
username Userforwhomyouwanttoretrievethepassword.