What's new on V2?


This 3 converts are famous on the php side and are strtotime() or https://www.unixtimestamp.com/index.php 

Why is this module made for?

What are the useful things I can do with this?


How do I know that this is well coded?

So the string goes using this logic: endpoint|key1=valuekey1|key2=valuekey2|....         

Finally the string to be signed is: /users/self|access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d

using the AppSecret as the "Secret" key for encryption in our script: 6dc1787668c64c939929c17683d7cb74

We're expecting this value: cbf5a1f41db44412506cb6563a3218b50f45a710c7a8a65a3e9b18315bb338bf

Matching exactly the value we were waiting

What do I need to use the Module?

This module can be used of any of the following ways

1. Unzip the content in "the personal Powershell Module" within your profile

  Hum!. How do I find the path of my "Personal Powershell Modules on my computer"?

 Easily, Open Powershell and run $env:PSModulePath.Split(";")

 You will get something like this:

Since I have the default value of "my Documents" Moved to Dropbox (so I don't lose anything in a Disk break, as backup). I have the 1st Item.

Make sure that the Folder Exists (It's normal if the folder doesn't exist), so let's make sure that is created by running this 2 lines:



$path="D:\Cloud\Dropbox\Documents\WindowsPowerShell\Modules\DoSign" # Added the DoSign folder that is required  
#If the folder doesn't exists create the folder, since it's a .Net it will create recursively all the folders it requires. 
if(! (test-path  $path)){ [System.IO.Directory]::CreateDirectory($path))}
 These lines check if the $path exists, if it does, it doesn't do anything, if it doesn't, then it will create the folders requested recursively.


So the folder structure is:



 |- DoSign.dll


 |- System.Management.Automation.dll


Note that there's not another folder within DoSign, so all the files should be on that path.


And then close PowerShell and open a new PowerShell console (so it loads the changes), then import the module and use the CmdLet within (Get-Sign).


Import-Module DoSign  
Get-Signed  -String2Sign "this" -Algorithm SHA256 -Secret "ThisisTheSecret" #fixedkey (secret)


The benefits of this way are to have always the module present in your PowerShell environment (so you are able to load it like any other without any further steps).

2. The other way is just to unzip in any path, go to that path using PowerShell and do:

Import-Module .\DoSign.dll

Get-Signed  -String2Sign "this" -Algorithm SHA256 -Secret "ThisisTheSecret" #fixedkey (secret)


This has to be every single time you want to use the module


Where the source code?

 It's right here: https://bitbucket.org/j0rt3g4/dosign-ps-module

And in the Visual Studio Dev: https://code.msdn.microsoft.com/windowsdesktop/Sign-any-string-using-5365d1ab


What are the parameters?

It has 2 mandatory parameters and 1 Optional:



Documentation links to the classes used:


How do I use it?

If you want to encrypt a string with a random key you can use:


Get-Signed  -String2Sign "this" -Algorithm SHA1 
Get-Signed  -String2Sign "this" -Algorithm SHA256 
Get-Signed  -String2Sign "this" -Algorithm SHA384 
Get-Signed  -String2Sign "this" -Algorithm SHA512 



In this commands, I'm encrypting the string "this" using the differents algorithm with a RANDOM KEY (since the "secret" parameter is not given). This means that if you want to change back you won't be able to do it, since the cmdlet doesn't save any information to do the computation of the hash, and the key is NOT the exception.

It's important to note here since the key is random, every time you run the Cmdlet you will get a different result.


Get-Signed  -String2Sign "this" -Algorithm SHA1 -Secret "ThisisTheSecret" 
Get-Signed  -String2Sign "this" -Algorithm SHA256 -Secret "ThisisTheSecret" 
Get-Signed  -String2Sign "this" -Algorithm SHA384 -Secret "ThisisTheSecret" 
Get-Signed  -String2Sign "this" -Algorithm SHA512 -Secret "ThisisTheSecret"



If you want to encrypt "this" using a specific secret key: