Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -84,24 +84,62 @@ namespace System.IdentityModel.Tokens
switch (algorithm) {
//case SignedXml.XmlDsigDSAUrl: // it is documented as supported, but it isn't in reality and it wouldn't be possible.
case SignedXml.XmlDsigRSASHA1Url:
return new HMACSHA1 ();
return new SHA1Managed ();
case SecurityAlgorithms.RsaSha256Signature:
return new HMACSHA256 ();
return new SHA256Managed ();
default:
throw new NotSupportedException (String.Format ("'{0}' Hash algorithm is not supported in this security key.", algorithm));
}
}
[MonoTODO]
public override AsymmetricSignatureDeformatter GetSignatureDeformatter (string algorithm)
{
throw new NotImplementedException ();
switch (algorithm) {
//case SignedXml.XmlDsigDSAUrl:
// DSA dsa = (cert.PublicKey.Key as DSA);
// if (dsa == null) {
// throw new NotSupportedException (String.Format ("The certificate does not contain DSA public key while '{0}' requires it.", algorithm));
// }
// else {
// return new DSASignatureDeformatter(dsa);
// }
case SignedXml.XmlDsigRSASHA1Url:
case SecurityAlgorithms.RsaSha256Signature:
RSA rsa = (cert.PublicKey.Key as RSA);
if (rsa == null) {
throw new NotSupportedException (String.Format ("The certificate does not contain RSA public key while '{0}' requires it.", algorithm));
}
else {
return new RSAPKCS1SignatureDeformatter (rsa);
}
default:
throw new NotSupportedException (String.Format ("'{0}' Hash algorithm is not supported in this security key.", algorithm));
}
}
[MonoTODO]
public override AsymmetricSignatureFormatter GetSignatureFormatter (string algorithm)
{
throw new NotImplementedException ();
switch (algorithm) {
//case SignedXml.XmlDsigDSAUrl:
// DSA dsa = (cert.PrivateKey as DSA);
// if (dsa == null) {
// throw new NotSupportedException (String.Format ("The certificate does not contain DSA private key while '{0}' requires it.", algorithm));
// }
// else {
// return new DSASignatureFormatter(dsa);
// }
case SignedXml.XmlDsigRSASHA1Url:
case SecurityAlgorithms.RsaSha256Signature:
RSA rsa = (cert.PrivateKey as RSA);
if (rsa == null) {
throw new NotSupportedException (String.Format ("The certificate does not contain RSA private key while '{0}' requires it.", algorithm));
}
else {
return new RSAPKCS1SignatureFormatter (rsa);
}
default:
throw new NotSupportedException (String.Format ("'{0}' Hash algorithm is not supported in this security key.", algorithm));
}
}
public override bool HasPrivateKey ()