Skip to content

Instantly share code, notes, and snippets.

View vadim-kovalyov's full-sized avatar
🇺🇦
🤍❤️🤍

Vadim Kovalyov vadim-kovalyov

🇺🇦
🤍❤️🤍
  • Microsoft
  • Redmond, WA
View GitHub Profile
@vadim-kovalyov
vadim-kovalyov / CreateDevCert.cmd
Created May 18, 2016 14:19
This script creates development CA and Cert for using with IIS.
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM This script must be run as Administrator
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM Create a CA Certificate and place it into Trusted Root Certificate authorities storage on local machine.
makecert -n "CN=Development Root CA" -r -pe -a sha512 -len 4096 -cy authority -sr localmachine -ss Root -sk "Development Root CA"
REM Create a dev Certificate and place it into Personal certificates on local machine.
makecert -pe -n "CN=*.dev.local" -a sha512 -len 2048 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -ir localmachine -is Root -in "Development Root CA" -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -sr localmachine -ss My -sk "*.dev.local"
@vadim-kovalyov
vadim-kovalyov / AESGCM.cs
Last active October 21, 2016 15:52 — forked from jbtule/AESGCM.cs
Two code examples that I borrowed as best practices for encrypting a string in c#. They both are using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@vadim-kovalyov
vadim-kovalyov / MultiAssert.cs
Created April 1, 2016 19:34
Sometimes in order to test one logical concern you need to use multiple asserts. This class helps with that.
/// <summary>
/// The multi assert.
/// </summary>
/// <remarks>
/// Sometimes in order to test one logical concern you need to use
/// multiple asserts. This class helps with that.
/// </remarks>
public static class MultiAssert
{
/// <summary>
@vadim-kovalyov
vadim-kovalyov / How to set ValidateAntiForgeryToken Attribute globaly
Last active June 28, 2019 08:04
How to set ValidateAntiForgeryToken Attribute globaly
public class AntiForgeryTokenFilterProvider : IFilterProvider
{
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
IEnumerable<FilterAttribute> filters = actionDescriptor.GetFilterAttributes(true);
bool disableAntiForgery = filters.Any(f => f is DisableAntiForgeryCheckAttribute);
string method = controllerContext.HttpContext.Request.HttpMethod;