.NET - Intergraph Smart Materials - Version 10.2 - Installation & Upgrade - Hexagon

Intergraph Smart Materials Installation (10.2)

Language
English
Product
Intergraph Smart Materials
Subproduct
Classic
Search by Category
Installation & Upgrade
Smart Materials/Smart Reference Data Version
10.2

Imports System.IO

Imports System.Security.Cryptography

Imports System.Text

Module Encryptor

Private ReadOnly mVerificationTerm As String = "Smart Materials Portal SSO"

Private ReadOnly mSsoPassword As String = "SMat.2015" 'Max 32 Byte

Private ReadOnly mInitializationVector As Byte() = New Byte() {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Private ReadOnly mSsoWebLauncherUrl As String = "http://www.ssoweblauncherlocation.com/index.aspx"

Public Sub Main()

Dim companyId As Long = 12345

Dim email As String = "smat@acme.com"

Dim updatedPassword As String = mSsoPassword.PadRight(32, CChar("0"))

Dim sso1 As Object = BitConverter.ToString(GetEncryptedHexCode(updatedPassword, mVerificationTerm)).Replace("-", "")

Dim sso2 As Object = BitConverter.ToString(GetEncryptedHexCode(updatedPassword, CStr(companyId))).Replace("-", "")

Dim sso3 As Object = BitConverter.ToString(GetEncryptedHexCode(updatedPassword, email)).Replace("-", "")

Dim output As String = String.Format("{0}{1}{2}{3}{4}{5}", "?sso1=", sso1, "&sso2=", sso2, "&sso3=", sso3)

Dim url As String = String.Format("{0}{1}", mSsoWebLauncherUrl, output)

'Run Browser

Dim psi As New ProcessStartInfo("iexplore.exe")

psi.Arguments = url

Process.Start(psi)

End Sub

Private Function GetEncryptedHexCode(ssoPassword As String, input As String) As Byte()

Dim encrypted As Byte() = Nothing

Using myAes As New AesCryptoServiceProvider()

myAes.KeySize = 256

myAes.Key = Encoding.ASCII.GetBytes(ssoPassword)

myAes.IV = mInitializationVector

Dim encryptor As ICryptoTransform = myAes.CreateEncryptor(myAes.Key, myAes.IV)

Dim msEncrypt As New MemoryStream()

Using csEncrypt As New CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)

Using swEncrypt As New StreamWriter(csEncrypt)

swEncrypt.Write(input)

End Using

encrypted = msEncrypt.ToArray()

End Using

End Using

Return encrypted

End Function

End Module