summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs
new file mode 100644
index 0000000..b3ac78b
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtEncryptionAlgorithm.cs
@@ -0,0 +1,41 @@
+//-----------------------------------------------------------------------
+// <copyright file="JwtEncryptionAlgorithm.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OAuth2.Crypto {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using DotNetOpenAuth.Messaging;
+
+ internal abstract class JwtEncryptionAlgorithm : IDisposable {
+ protected JwtEncryptionAlgorithm(string algorithmName, string encryptionMethod) {
+ Requires.NotNullOrEmpty(algorithmName, "algorithmName");
+ Requires.NotNullOrEmpty(encryptionMethod, "encryptionMethod");
+ this.Header = new JweHeader(algorithmName, encryptionMethod);
+ }
+
+ internal JweHeader Header { get; private set; }
+
+ internal abstract void Encrypt(byte[] plainText, out byte[] cipherText, out byte[] integrityValue);
+
+ internal abstract byte[] Decrypt(byte[] cipherText, byte[] integrityValue);
+
+ public void Dispose() {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing) {
+ }
+
+ protected void KeyDerivation(byte[] contentMasterKey, out byte[] contentEncryptionKey, out byte[] contentIntegrityKey) {
+ // Implementing this would be manual, or involve P/Invoke I think.
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375393(v=vs.85).aspx
+ throw new NotImplementedException();
+ }
+ }
+}