-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
565 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
using NServiceBus; | ||
|
||
namespace Messages | ||
{ | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public class MessageWithSecretData : IMessage | ||
{ | ||
public WireEncryptedString Secret { get; set; } | ||
} | ||
public MySecretSubProperty SubProperty{ get; set; } | ||
public List<CreditCardDetails> CreditCards { get; set; } | ||
} | ||
|
||
public class CreditCardDetails | ||
{ | ||
public DateTime ValidTo { get; set; } | ||
public WireEncryptedString Number { get; set; } | ||
} | ||
|
||
public class MySecretSubProperty | ||
{ | ||
public WireEncryptedString Secret { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
using System; | ||
using Messages; | ||
using NServiceBus; | ||
|
||
namespace Server | ||
{ | ||
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization | ||
{ | ||
public void Init() | ||
{ | ||
Configure.With() | ||
.StructureMapBuilder() | ||
.RijndaelEncryptionService(); | ||
} | ||
} | ||
|
||
public class Handler : IHandleMessages<MessageWithSecretData> | ||
{ | ||
public void Handle(MessageWithSecretData message) | ||
{ | ||
Console.WriteLine("I know your secret - it's '" + message.Secret + "'."); | ||
} | ||
} | ||
} | ||
using System; | ||
using Messages; | ||
using NServiceBus; | ||
|
||
namespace Server | ||
{ | ||
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization | ||
{ | ||
public void Init() | ||
{ | ||
Configure.With() | ||
.StructureMapBuilder() | ||
.RijndaelEncryptionService(); | ||
} | ||
} | ||
|
||
public class Handler : IHandleMessages<MessageWithSecretData> | ||
{ | ||
public void Handle(MessageWithSecretData message) | ||
{ | ||
Console.Out.WriteLine("I know your secret - it's '" + message.Secret + "'"); | ||
|
||
if (message.SubProperty != null) | ||
Console.Out.WriteLine("SubSecret: " + message.SubProperty.Secret); | ||
|
||
|
||
if (message.CreditCards != null) | ||
foreach (var creditCard in message.CreditCards) | ||
Console.Out.WriteLine("CreditCard: {0} is valid to {1}", creditCard.Number.Value, creditCard.ValidTo); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/encryption/NServiceBus.Encryption/Config/ConfigureEncryption.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace NServiceBus.Encryption.Config | ||
{ | ||
public static class ConfigureEncryption | ||
{ | ||
static ConfigureEncryption() | ||
{ | ||
EnsureCompatibilityWithNSB2 = true; | ||
} | ||
|
||
/// <summary> | ||
/// Causes the endpoint to no longer send extra data to make encryption compatible with NSB 2.X | ||
/// </summary> | ||
/// <returns></returns> | ||
public static Configure DisableCompatibilityWithNSB2(this Configure config) | ||
{ | ||
EnsureCompatibilityWithNSB2 = false; | ||
return config; | ||
} | ||
|
||
public static bool EnsureCompatibilityWithNSB2 { get; set; } | ||
} | ||
} |
Oops, something went wrong.