Author: atsushi
Date: 2007-01-15 03:40:55 -0500 (Mon, 15 Jan 2007)
New Revision: 71007
Modified:
Log:
2007-01-15 Atsushi Enomoto <atsushi (AT) ximian (DOT) com>
* SecurityAlgorithmSuite.cs : give more meaningful field names.
Implemented some Is[blah]Supported() methods.
* WSSecurityTokenSerializer.cs : corcompare fix.
* SecurityVersion : removed MonoTD
* some tests for writing derived-
key-involved key identifier clauses.
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -1,3 +1,10 @@
+2007-01-15 Atsushi Enomoto <atsushi (AT) ximian (DOT) com>
+
+* SecurityAlgorithmSuite.cs : give more meaningful field names.
+ Implemented some Is[blah]Supported() methods.
+* WSSecurityTokenSerializer.cs : corcompare fix.
+* SecurityVersion : removed MonoTD
+
2007-01-12 Atsushi Enomoto <atsushi (AT) ximian (DOT) com>
* :
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -33,7 +33,6 @@
namespace System.ServiceModel.Security
{
-[MonoTD]
public abstract class SecurityAlgorithmSuite
{
#region Internal Class
@@ -44,6 +43,48 @@
: base (size, sha, rsa, false)
{
}
+
+public override int {
+get { return Size 192 ? 192 : Size; }
+}
+
+public override bool IsAsymmetricKeyLengthSupported (int length)
+{
+switch (length) {
+case 128:
+case 192:
+return Size >= length;
+}
+return false;
+}
+
+public override bool IsSymmetricKeyLengthSupported (int length)
+{
+switch (length) {
+case 128:
+case 192:
+case 256:
+return Size >= length;
+}
+return false;
+}
+
+public override bool (string algorithm)
+{
+switch (Size) {
+case 256:
+if (algorithm == )
+return true;
+goto case 192;
+case 192:
+if (algorithm == )
+return true;
+goto case 128;
+case 128:
+return algorithm == ;
+}
+return false;
+}
}
class : SecurityAlgorithmSuiteImplBase
@@ -52,19 +93,39 @@
: base (192, sha, rsa, true)
{
}
+
+public override int {
+get { return 192; }
+}
+
+public override bool IsAsymmetricKeyLengthSupported (int length)
+{
+return length == 192;
+}
+
+public override bool IsSymmetricKeyLengthSupported (int length)
+{
+return length == 192;
+}
+
+public override bool (
+string algorithm)
+{
+return algorithm == ;
+}
}
-class SecurityAlgorithmSuiteImplBase : SecurityAlgorithmSuite
+abstract class SecurityAlgorithmSuiteImplBase : SecurityAlgorithmSuite
{
int size;
-bool rsa, sha, tdes;
+bool rsa15, sha256, tdes;
public SecurityAlgorithmSuiteImplBase (
-int size, bool sha, bool rsa, bool tripleDes)
+int size, bool sha256, bool rsa15, bool tripleDes)
{
this.size = size;
-this.sha = sha;
-this.rsa = rsa;
+this.sha256 = sha256;
+this.rsa15 = rsa15;
this.tdes = tripleDes;
}
@@ -72,20 +133,20 @@
get { return size; }
}
-public bool Rsa {
-get { return rsa; }
+public bool Rsa15 {
+get { return rsa15; }
}
-public bool Sha {
-get { return sha; }
+public bool Sha256 {
+get { return sha256; }
}
public override string {
-get { return rsa ? EncryptedXml.XmlEncRSA15Url : EncryptedXml.XmlEncRSAAEPUrl; }
+get { return rsa15 ? EncryptedXml.XmlEncRSA15Url : EncryptedXml.XmlEncRSAAEPUrl; }
}
public override string {
-get { return sha ? : SignedXml.XmlDsigRSASHA1Url; }
+get { return sha256 ? : SignedXml.XmlDsigRSASHA1Url; }
}
public override string {
@@ -94,7 +155,7 @@
public override string DefaultDigestAlgorithm {
-get { return sha ? EncryptedXml.XmlEncSHA256Url : SignedXml.XmlDsigSHA1Url; }
+get { return sha256 ? EncryptedXml.XmlEncSHA256Url : SignedXml.XmlDsigSHA1Url; }
}
public override string DefaultEncryptionAlgorithm {
@@ -117,11 +178,6 @@
get { return size; }
}
-public override int {
-// FIXME: find out the reason why.
-get { return size == 256 ? 192 : size; }
-}
-
public override int DefaultSymmetricKeyLength {
get { return size; }
}
@@ -143,27 +199,10 @@
}
public override string {
-get { return sha ? : SignedXml.XmlDsigHMACSHA1Url; }
+get { return sha256 ? : SignedXml.XmlDsigHMACSHA1Url; }
}
-public override bool IsAsymmetricKeyLengthSupported (int length)
-{
-throw new NotImplementedException ();
-}
-
-public override bool IsSymmetricKeyLengthSupported (int length)
-{
-throw new NotImplementedException ();
-}
-
[MonoTD]
-public override bool (
-string algorithm)
-{
-throw new NotImplementedException ();
-}
-
-[MonoTD]
public override bool (
string algorithm)
{
@@ -205,13 +244,6 @@
}
[MonoTD]
-public override bool (
-string algorithm)
-{
-throw new NotImplementedException ();
-}
-
-[MonoTD]
public override bool (
string algorithm)
{
@@ -248,87 +280,70 @@
tdes_sr = new (true, true);
}
-[MonoTD]
public static SecurityAlgorithmSuite Default {
get { return Basic256; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic128 {
get { return b128; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic128Rsa15 {
get { return b128r; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic128Sha256 {
get { return b128s; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic128Sha256Rsa15 {
get { return b128sr; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic192 {
get { return b192; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic192Rsa15 {
get { return b192r; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic192Sha256 {
get { return b192s; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic192Sha256Rsa15 {
get { return b192sr; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic256 {
get { return b256; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic256Rsa15 {
get { return b256r; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic256Sha256 {
get { return b256s; }
}
-[MonoTD]
public static SecurityAlgorithmSuite Basic256Sha256Rsa15 {
get { return b256sr; }
}
-[MonoTD]
public static SecurityAlgorithmSuite TripleDes {
get { return tdes; }
}
-[MonoTD]
public static SecurityAlgorithmSuite TripleDesRsa15 {
get { return tdes_r; }
}
-[MonoTD]
public static SecurityAlgorithmSuite TripleDesSha256 {
get { return tdes_s; }
}
-[MonoTD]
public static SecurityAlgorithmSuite TripleDesSha256Rsa15 {
get { return tdes_sr; }
}
@@ -361,20 +376,18 @@
public abstract string { get; }
+public virtual bool (
+string algorithm)
+{
+return algorithm == ;
+}
+
public abstract bool IsAsymmetricKeyLengthSupported (int length);
-[MonoTD]
-public virtual bool (
-string algorithm)
-{
-throw new NotImplementedException ();
-}
-
-[MonoTD]
public virtual bool (
string algorithm)
{
-throw new NotImplementedException ();
+return algorithm == ;
}
[MonoTD]
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -28,7 +28,6 @@
namespace System.ServiceModel.Security
{
-[MonoTD]
public abstract class SecurityVersion
{
static SecurityVersion wss10, wss11;
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -203,7 +203,7 @@
}
[MonoTD]
-public SecurityKeyIdentifierClause (
+public virtual SecurityKeyIdentifierClause (
XmlElement tokenXml, SecurityTokenReferenceStyle referenceStyle)
{
throw new NotImplementedException ();
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -1,3 +1,8 @@
+2007-01-15 Atsushi Enomoto <atsushi (AT) ximian (DOT) com>
+
+* some tests for writing derived-
+ key-involved key identifier clauses.
+
2007-01-12 Atsushi Enomoto <atsushi (AT) ximian (DOT) com>
* : added some tests for
Modified:
2007-01-15 08:37:41 UTC (rev 71006)
2007-01-15 08:40:55 UTC (rev 71007)
@@ -286,6 +286,27 @@
}
[Test]
+public void () // derived key
+{
+StringWriter sw = new StringWriter ();
+byte [] bytes = new byte [32];
+SecurityKeyIdentifier cki = new SecurityKeyIdentifier ();
+cki.Add (new (cert));
+EncryptedKeyIdentifierClause ic =
+new EncryptedKeyIdentifierClause (bytes, , cki, "carriedKeyNaaaaame", new byte [32], 32);
+
+using (XmlWriter w = XmlWriter.Create (sw, GetWriterSettings ())) {
+ (w, ic);
+}
+string expected = String.Format ("<e:EncryptedKey xmlns:e=\"{0}\"><e:EncryptionMethod Algorithm=\"{1}\" /><KeyInfo xmlns=\"{2}\"><o:SecurityTokenReference xmlns:o=\"\"><o:KeyIdentifier ValueType=\"{3}\">GQ3YHlGQhDF1bvMixHliX4uLjlY=</o:KeyIdentifier></o:SecurityTokenReference></KeyInfo><e:CipherData><e:CipherValue></e:CipherValue></e:CipherData><e:CarriedKeyName>carriedKeyNaaaaame</e:CarriedKeyName></e:EncryptedKey>",
+,
+,
+SignedXml.XmlDsigNamespaceUrl,
+"#ThumbprintSHA1");
+Assert.AreEqual (expected, sw.ToString ());
+}
+
+[Test]
public void ()
{
StringWriter sw = new StringWriter ();
@@ -331,6 +352,18 @@
}
[Test]
+[Ignore ("fails on .net; no further verification")]
+public void () // derivedKey
+{
+StringWriter sw = new StringWriter ();
+LocalIdKeyIdentifierClause ic = new LocalIdKeyIdentifierClause ("urn:myIDValue", new byte [32], 16, typeof (WrappedKeySecurityToken));
+using (XmlWriter w = XmlWriter.Create (sw, GetWriterSettings ())) {
+new WSSecurityTokenSerializer (true).WriteKeyIdentifierClause (w, ic);
+}
+Assert.AreEqual ("<o:SecurityTokenReference xmlns:o=\"\"><o:Reference ValueType=\"#EncryptedKey\" URI=\"#urn:myIDValue\" /></o:SecurityTokenReference>", sw.ToString (), "#1");
+}
+
+[Test]
public void ReadKeyIdentifierClause ()
{
string xml = @"<o:SecurityTokenReference xmlns:o=''>
Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com