Skip to content

Instantly share code, notes, and snippets.

Shawn Kendrot skendrot

Block or report user

Report or block skendrot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d497d938ec96a08f3bf0
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.Storage.Streams;
namespace Pinnacle.Pickers
{
View WinRT Behavior
// WinRT Implementation of the base Behavior classes
public abstract class Behavior<T> : Behavior where T : DependencyObject
{
protected T AssociatedObject
{
get { return base.AssociatedObject as T; }
}
protected override void OnAttached()
{
@skendrot
skendrot / TrialService
Created Jul 24, 2014
Service for determining if a user's trial has expired.
View TrialService
class AzureTrialService : ITrialService
{
private readonly IMobileServiceClient _service;
public AzureTrialService(IMobileServiceClient service)
{
_service = service;
TrialPeriod = TimeSpan.FromDays(7);
}
View gist:2b2b529605f0b07aba55
private static string EncryptData(PublicKey key, string plainText)
{
byte[] exponent = HexToBytes(key.Exponent);
byte[] modulus = HexToBytes(key.Modulus);
//**************** NEW **************************
IAsymmetricKeyAlgorithmProvider provider = PCLCrypto.WinRTCrypto.AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaSignPssSha512);
byte[] keyBlob == null; // how to convert my PublicKey class?
ICryptographicKey cryptographicKey = provider.ImportKeyPair(keyBlob)
You can’t perform that action at this time.