1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 15:23:42 +00:00

setup, build, and run scripts

This commit is contained in:
Kyle Spearrin
2017-08-07 11:24:16 -04:00
parent 4a25abade8
commit ee8b0a25a8
26 changed files with 257 additions and 33 deletions

View File

@@ -98,7 +98,7 @@ namespace Bit.Core.Utilities
{
// Clean possible garbage characters from thumbprint copy/paste
// ref http://stackoverflow.com/questions/8448147/problems-with-x509store-certificates-find-findbythumbprint
thumbprint = Regex.Replace(thumbprint, @"[^\da-zA-z]", string.Empty).ToUpper();
thumbprint = Regex.Replace(thumbprint, @"[^\da-fA-F]", string.Empty).ToUpper();
X509Certificate2 cert = null;
var certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
@@ -113,6 +113,11 @@ namespace Bit.Core.Utilities
return cert;
}
public static X509Certificate2 GetCertificate(string file, string password)
{
return new X509Certificate2(file, password);
}
public static long ToEpocMilliseconds(DateTime date)
{
return (long)Math.Round((date - _epoc).TotalMilliseconds, 0);