Exemple #1
0
 public Key(
     Guid keyId,
     DateTimeOffset creationDate,
     DateTimeOffset activationDate,
     DateTimeOffset expirationDate,
     IAuthenticatedEncryptorDescriptor descriptor,
     IEnumerable <IAuthenticatedEncryptorFactory> encryptorFactories)
     : base(keyId,
            creationDate,
            activationDate,
            expirationDate,
            new Lazy <IAuthenticatedEncryptorDescriptor>(() => descriptor),
            encryptorFactories)
 {
 }
Exemple #2
0
 public Key(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate, IAuthenticatedEncryptorDescriptor descriptor)
     : base(keyId, creationDate, activationDate, expirationDate, new Lazy <IAuthenticatedEncryptor>(descriptor.CreateEncryptorInstance))
 {
 }
Exemple #3
0
 /// <summary>
 /// Sets up a mock such that given the name of a deserializer class and the XML node that class's
 /// Import method should expect returns a descriptor which produces the given authenticator.
 /// </summary>
 public static void ReturnDescriptorGivenDeserializerTypeNameAndInput(this Mock <IActivator> mockActivator, string typeName, string xml, IAuthenticatedEncryptorDescriptor descriptor)
 {
     mockActivator
     .Setup(o => o.CreateInstance(typeof(IAuthenticatedEncryptorDescriptorDeserializer), typeName))
     .Returns(() =>
     {
         var mockDeserializer = new Mock <IAuthenticatedEncryptorDescriptorDeserializer>();
         mockDeserializer
         .Setup(o => o.ImportFromXml(It.IsAny <XElement>()))
         .Returns <XElement>(el =>
         {
             // Only return the descriptor if the XML matches
             XmlAssert.Equal(xml, el);
             return(descriptor);
         });
         return(mockDeserializer.Object);
     });
 }
 public TestEncryptorFactory(IAuthenticatedEncryptorDescriptor associatedDescriptor = null, IAuthenticatedEncryptor expectedEncryptor = null)
 {
     _associatedDescriptor = associatedDescriptor;
     _expectedEncryptor    = expectedEncryptor;
 }
Exemple #5
0
 public Key(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate, IAuthenticatedEncryptorDescriptor descriptor)
     : base(keyId, creationDate, activationDate, expirationDate, new Lazy<IAuthenticatedEncryptor>(descriptor.CreateEncryptorInstance))
 {
 }