Sync editor encryption pwd

Hi Team,

Below code is still returning encrypted pwd stored in sync editor.


Looks like this piece of code is not working

"' Decrypt the password using the decryption method
Dim decrypter As VI.Projector.Security.DatabaseEncryption = New VI.Projector.Security.DatabaseEncryption(Connection.Session)
pwd = decrypter.Decrypt(pwd)"

Could you please correct my code?

References System.DirectoryServices.dll
Imports System.DirectoryServices
Imports System.DirectoryServices.AccountManagement

References VI.DB.dll
Imports VI.DB
Imports VI.DB.Entities
Imports VI.DB.Scripting
Imports VI.DB.Scripting.ScriptBase

Public Function A_AA_TestBed(ByVal uidVariableSet As String) As String
' Get the username and encrypted password from the system variable
Dim UserName As String = CCC_Get_DPRSystemVariableValue(uidVariableSet, "CP_BASEloginaccount")
Dim Pwd As String = CCC_Get_DPRSystemVariableValue(uidVariableSet, "CP_BASEpassword")

' Decrypt the password using the decryption method
Dim decrypter As VI.Projector.Security.DatabaseEncryption = New VI.Projector.Security.DatabaseEncryption(Connection.Session)
pwd = decrypter.Decrypt(pwd)

' Get the list of AD servers
Dim ServerList As String = CCC_Get_DPRSystemVariableValue(uidVariableSet, "CP_ADServerList")
Dim TargetADServers() As String = ServerList.Split(New Char() {","c}) ' Split the list into an array

' Iterate through all the AD servers in the array

' Loop through each AD server in the list and try to validate credentials
For Each server As String In TargetADServers
Using context As New PrincipalContext(ContextType.Domain, server.Trim())
Dim valid As Boolean = context.ValidateCredentials(UserName, pwd)
If valid Then
' Return the first AD server that successfully validates the credentials
Return server.Trim()
End If
End Using
Next

' If no valid server is found, return nothing (implicitly returns Nothing)
Return Nothing
End Function

Parents Reply Children
No Data