Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -16,6 +16,8 @@ LOCAL_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414
XTEST_LIB_REFS = System.Core System Facades/System.Linq Facades/System.Threading.Tasks
EXTRA_DISTFILES = \
Test/System.Security.Cryptography.Xml/sample.pfx \
Test/System.Security.Cryptography.Xml/EncryptedXmlSample1.xml \
@@ -24,6 +26,8 @@ EXTRA_DISTFILES = \
Test/System.Security.Cryptography.Pkcs/detached.data \
Test/System.Security.Cryptography.Pkcs/detached.p7
RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx
RESX_RESOURCE_STRING = \
../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx \
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Resources/Strings.resx
include ../../build/library.make

View File

@@ -382,7 +382,7 @@ namespace System.Security.Cryptography.Xml {
}
// See if there is a signature description class defined in the Config file
SignatureDescription signatureDescription = CryptoHelpers.CreateFromName (SignedInfo.SignatureMethod) as SignatureDescription;
SignatureDescription signatureDescription = CryptoHelpers.CreateFromName<SignatureDescription> (SignedInfo.SignatureMethod);
if (signatureDescription == null)
throw new CryptographicException (SR.Cryptography_Xml_SignatureDescriptionNotCreated);
HashAlgorithm hashAlg = signatureDescription.CreateDigest ();
@@ -603,7 +603,7 @@ namespace System.Security.Cryptography.Xml {
return false;
// See if we're signed witn an HMAC algorithm
HMAC hmac = CryptoHelpers.CreateFromName (SignatureMethod) as HMAC;
HMAC hmac = CryptoHelpers.CreateFromName<HMAC> (SignatureMethod);
if (hmac == null)
return false; // We aren't signed with an HMAC algorithm, so we cannot have a truncated HMAC
@@ -930,7 +930,7 @@ namespace System.Security.Cryptography.Xml {
SignedXmlDebugLog.LogBeginCheckSignedInfo (this, m_signature.SignedInfo);
SignatureDescription signatureDescription = CryptoHelpers.CreateFromName (SignatureMethod) as SignatureDescription;
SignatureDescription signatureDescription = CryptoHelpers.CreateFromName<SignatureDescription> (SignatureMethod);
if (signatureDescription == null)
throw new CryptographicException (SR.Cryptography_Xml_SignatureDescriptionNotCreated);

View File

@@ -1,76 +0,0 @@
//
// System.Security.Cryptography.CryptographicAttributeObject class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if SECURITY_DEP
using System.Collections;
namespace System.Security.Cryptography {
public sealed class CryptographicAttributeObject {
private Oid _oid;
private AsnEncodedDataCollection _list;
// constructors
public CryptographicAttributeObject (Oid oid)
{
if (oid == null)
throw new ArgumentNullException ("oid");
_oid = new Oid (oid);
_list = new AsnEncodedDataCollection ();
}
public CryptographicAttributeObject (Oid oid, AsnEncodedDataCollection values)
{
if (oid == null)
throw new ArgumentNullException ("oid");
_oid = new Oid (oid);
if (values == null)
_list = new AsnEncodedDataCollection ();
else
_list = values;
}
// properties
public Oid Oid {
get { return _oid; }
}
public AsnEncodedDataCollection Values {
get { return _list; }
}
}
}
#endif

View File

@@ -1,134 +0,0 @@
//
// System.Security.Cryptography.CryptographicAttributeObjectCollection class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if SECURITY_DEP
using System.Collections;
namespace System.Security.Cryptography {
public sealed class CryptographicAttributeObjectCollection : ICollection, IEnumerable {
private ArrayList _list;
public CryptographicAttributeObjectCollection ()
{
_list = new ArrayList ();
}
public CryptographicAttributeObjectCollection (CryptographicAttributeObject attribute)
: this ()
{
_list.Add (attribute);
}
// properties
public int Count {
get { return _list.Count; }
}
public bool IsSynchronized {
get { return _list.IsSynchronized; }
}
public CryptographicAttributeObject this [int index] {
get { return (CryptographicAttributeObject) _list [index]; }
}
public object SyncRoot {
get { return this; }
}
// methods
public int Add (AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException ("asnEncodedData");
AsnEncodedDataCollection coll = new AsnEncodedDataCollection (asnEncodedData);
return Add (new CryptographicAttributeObject (asnEncodedData.Oid, coll));
}
public int Add (CryptographicAttributeObject attribute)
{
if (attribute == null)
throw new ArgumentNullException ("attribute");
int existing = -1;
string oid = attribute.Oid.Value;
for (int i=0; i < _list.Count; i++) {
if ((_list[i] as CryptographicAttributeObject).Oid.Value == oid) {
existing = i;
break;
}
}
if (existing >= 0) {
CryptographicAttributeObject cao = this[existing];
foreach (AsnEncodedData value in attribute.Values) {
cao.Values.Add (value);
}
return existing;
} else {
return _list.Add (attribute);
}
}
public void CopyTo (CryptographicAttributeObject[] array, int index)
{
_list.CopyTo (array, index);
}
void ICollection.CopyTo (Array array, int index)
{
_list.CopyTo (array, index);
}
public CryptographicAttributeObjectEnumerator GetEnumerator ()
{
return new CryptographicAttributeObjectEnumerator (_list);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return new CryptographicAttributeObjectEnumerator (_list);
}
public void Remove (CryptographicAttributeObject attribute)
{
if (attribute == null)
throw new ArgumentNullException ("attribute");
_list.Remove (attribute);
}
}
}
#endif

View File

@@ -1,71 +0,0 @@
//
// System.Security.Cryptography.CryptographicAttributeObjectEnumerator class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if SECURITY_DEP
using System.Collections;
namespace System.Security.Cryptography {
public sealed class CryptographicAttributeObjectEnumerator : IEnumerator {
private IEnumerator enumerator;
// constructors
internal CryptographicAttributeObjectEnumerator (IEnumerable enumerable)
{
enumerator = enumerable.GetEnumerator ();
}
// properties
public CryptographicAttributeObject Current {
get { return (CryptographicAttributeObject) enumerator.Current; }
}
object IEnumerator.Current {
get { return enumerator.Current; }
}
// methods
public bool MoveNext ()
{
return enumerator.MoveNext ();
}
public void Reset ()
{
enumerator.Reset ();
}
}
}
#endif

View File

@@ -1,3 +1,4 @@
../../build/common/SR.cs
Assembly/AssemblyInfo.cs
corefx/SR.cs
@@ -6,9 +7,10 @@ corefx/SR.cs
../../build/common/MonoTODOAttribute.cs
# System.Security.Cryptography
System.Security.Cryptography/CryptographicAttribute.cs
System.Security.Cryptography/CryptographicAttributeCollection.cs
System.Security.Cryptography/CryptographicAttributeEnumerator.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObject.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObjectCollection.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObjectEnumerator.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs
System.Security.Cryptography/DataProtectionScope.cs
System.Security.Cryptography/ProtectedData.cs
@@ -38,4 +40,4 @@ System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs
# System.Security.Cryptography.Xml
../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs

View File

@@ -91,4 +91,78 @@ partial class SR
public const string Log_XmlContext = "Using context: {0}";
public const string Log_SignedXmlRecursionLimit = "Signed xml recursion limit hit while trying to decrypt the key. Reference {0} hashed with \"{1}\" and ({2}).";
public const string Log_UnsafeTransformMethod = "Transform method \"{0}\" is not on the safe list. Safe transform methods are: {1}.";
}
public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action.";
public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
public const string Argument_InvalidOidValue = "The OID value was invalid.";
public const string Cryptography_Asn_EnumeratedValueRequiresNonFlagsEnum = "ASN.1 Enumerated values only apply to enum types without the [Flags] attribute.";
public const string Cryptography_Asn_NamedBitListRequiresFlagsEnum = "Named bit list operations require an enum with the [Flags] attribute.";
public const string Cryptography_Asn_NamedBitListValueTooBig = "The encoded named bit list value is larger than the value size of the '{0}' enum.";
public const string Cryptography_Asn_UniversalValueIsFixed = "Tags with TagClass Universal must have the appropriate TagValue value for the data type being read or written.";
public const string Cryptography_Asn_UnusedBitCountRange = "Unused bit count must be between 0 and 7, inclusive.";
public const string Cryptography_AsnSerializer_AmbiguousFieldType = "Field '{0}' of type '{1}' has ambiguous type '{2}', an attribute derived from AsnTypeAttribute is required.";
public const string Cryptography_AsnSerializer_Choice_AllowNullNonNullable = "[Choice].AllowNull=true is not valid because type '{0}' cannot have a null value.";
public const string Cryptography_AsnSerializer_Choice_ConflictingTagMapping = "The tag ({0} {1}) for field '{2}' on type '{3}' already is associated in this context with field '{4}' on type '{5}'.";
public const string Cryptography_AsnSerializer_Choice_DefaultValueDisallowed = "Field '{0}' on [Choice] type '{1}' has a default value, which is not permitted.";
public const string Cryptography_AsnSerializer_Choice_NoChoiceWasMade = "An instance of [Choice] type '{0}' has no non-null fields.";
public const string Cryptography_AsnSerializer_Choice_NonNullableField = "Field '{0}' on [Choice] type '{1}' can not be assigned a null value.";
public const string Cryptography_AsnSerializer_Choice_TooManyValues = "Fields '{0}' and '{1}' on type '{2}' are both non-null when only one value is permitted.";
public const string Cryptography_AsnSerializer_Choice_TypeCycle = "Field '{0}' on [Choice] type '{1}' has introduced a type chain cycle.";
public const string Cryptography_AsnSerializer_MultipleAsnTypeAttributes = "Field '{0}' on type '{1}' has multiple attributes deriving from '{2}' when at most one is permitted.";
public const string Cryptography_AsnSerializer_NoJaggedArrays = "Type '{0}' cannot be serialized or deserialized because it is an array of arrays.";
public const string Cryptography_AsnSerializer_NoMultiDimensionalArrays = "Type '{0}' cannot be serialized or deserialized because it is a multi-dimensional array.";
public const string Cryptography_AsnSerializer_NoOpenTypes = "Type '{0}' cannot be serialized or deserialized because it is not sealed or has unbound generic parameters.";
public const string Cryptography_AsnSerializer_Optional_NonNullableField = "Field '{0}' on type '{1}' is declared [OptionalValue], but it can not be assigned a null value.";
public const string Cryptography_AsnSerializer_PopulateFriendlyNameOnString = "Field '{0}' on type '{1}' has [ObjectIdentifier].PopulateFriendlyName set to true, which is not applicable to a string. Change the field to '{2}' or set PopulateFriendlyName to false.";
public const string Cryptography_AsnSerializer_SetValueException = "Unable to set field {0} on type {1}.";
public const string Cryptography_AsnSerializer_SpecificTagChoice = "Field '{0}' on type '{1}' has specified an implicit tag value via [ExpectedTag] for [Choice] type '{2}'. ExplicitTag must be true, or the [ExpectedTag] attribute removed.";
public const string Cryptography_AsnSerializer_UnexpectedTypeForAttribute = "Field '{0}' of type '{1}' has an effective type of '{2}' when one of ({3}) was expected.";
public const string Cryptography_AsnSerializer_UtcTimeTwoDigitYearMaxTooSmall = "Field '{0}' on type '{1}' has a [UtcTime] TwoDigitYearMax value ({2}) smaller than the minimum (99).";
public const string Cryptography_AsnSerializer_UnhandledType = "Could not determine how to serialize or deserialize type '{0}'.";
public const string Cryptography_AsnWriter_EncodeUnbalancedStack = "Encode cannot be called while a Sequence or SetOf is still open.";
public const string Cryptography_AsnWriter_PopWrongTag = "Cannot pop the requested tag as it is not currently in progress.";
public const string Cryptography_BadHashValue = "The hash value is not correct.";
public const string Cryptography_BadSignature = "Invalid signature.";
public const string Cryptography_Cms_CannotDetermineSignatureAlgorithm = "Could not determine signature algorithm for the signer certificate.";
public const string Cryptography_Cms_IncompleteCertChain = "The certificate chain is incomplete, the self-signed root authority could not be determined.";
public const string Cryptography_Cms_Invalid_Originator_Identifier_Choice = "Invalid originator identifier choice {0} found in decoded CMS.";
public const string Cryptography_Cms_Invalid_Subject_Identifier_Type = "The subject identifier type {0} is not valid.";
public const string Cryptography_Cms_InvalidMessageType = "Invalid cryptographic message type.";
public const string Cryptography_Cms_InvalidSignerHashForSignatureAlg = "SignerInfo digest algorithm '{0}' is not valid for signature algorithm '{1}'.";
public const string Cryptography_Cms_Key_Agree_Date_Not_Available = "The Date property is not available for none KID key agree recipient.";
public const string Cryptography_Cms_MessageNotEncrypted = "The CMS message is not encrypted.";
public const string Cryptography_Cms_MessageNotSigned = "The CMS message is not signed.";
public const string Cryptography_Cms_MissingAuthenticatedAttribute = "The cryptographic message does not contain an expected authenticated attribute.";
public const string Cryptography_Cms_NoCounterCounterSigner = "Only one level of counter-signatures are supported on this platform.";
public const string Cryptography_Cms_NoRecipients = "The recipients collection is empty. You must specify at least one recipient. This platform does not implement the certificate picker UI.";
public const string Cryptography_Cms_NoSignerCert = "No signer certificate was provided. This platform does not implement the certificate picker UI.";
public const string Cryptography_Cms_NoSignerAtIndex = "The signed cryptographic message does not have a signer for the specified signer index.";
public const string Cryptography_Cms_RecipientNotFound = "The enveloped-data message does not contain the specified recipient.";
public const string Cryptography_Cms_RecipientType_NotSupported = "The recipient type '{0}' is not supported for encryption or decryption on this platform.";
public const string Cryptography_Cms_Sign_Empty_Content = "Cannot create CMS signature for empty content.";
public const string Cryptography_Cms_SignerNotFound = "Cannot find the original signer.";
public const string Cryptography_Cms_Signing_RequiresPrivateKey = "A certificate with a private key is required.";
public const string Cryptography_Cms_TrustFailure = "Certificate trust could not be established. The first reported error is: {0}";
public const string Cryptography_Cms_UnknownAlgorithm = "Unknown algorithm '{0}'.";
public const string Cryptography_Cms_UnknownKeySpec = "Unable to determine the type of key handle from this keyspec {0}.";
public const string Cryptography_Cms_WrongKeyUsage = "The certificate is not valid for the requested usage.";
public const string Cryptography_Pkcs_InvalidSignatureParameters = "Invalid signature paramters.";
public const string Cryptography_Pkcs9_AttributeMismatch = "The parameter should be a PKCS 9 attribute.";
public const string Cryptography_Pkcs9_MultipleSigningTimeNotAllowed = "Cannot add multiple PKCS 9 signing time attributes.";
public const string Cryptography_Pkcs_PssParametersMissing = "PSS parameters were not present.";
public const string Cryptography_Pkcs_PssParametersHashMismatch = "This platform requires that the PSS hash algorithm ({0}) match the data digest algorithm ({1}).";
public const string Cryptography_Pkcs_PssParametersMgfHashMismatch = "This platform does not support the MGF hash algorithm ({0}) being different from the signature hash algorithm ({1}).";
public const string Cryptography_Pkcs_PssParametersMgfNotSupported = "Mask generation function '{0}' is not supported by this platform.";
public const string Cryptography_Pkcs_PssParametersSaltMismatch = "PSS salt size {0} is not supported by this platform with hash algorithm {1}.";
public const string Cryptography_TimestampReq_BadNonce = "The response from the timestamping server did not match the request nonce.";
public const string Cryptography_TimestampReq_BadResponse = "The response from the timestamping server was not understood.";
public const string Cryptography_TimestampReq_Failure = "The timestamping server did not grant the request. The request status is '{0}' with failure info '{1}'.";
public const string Cryptography_TimestampReq_NoCertFound = "The timestamping request required the TSA certificate in the response, but it was not found.";
public const string Cryptography_TimestampReq_UnexpectedCertFound = "The timestamping request required the TSA certificate not be included in the response, but certificates were present.";
public const string InvalidOperation_DuplicateItemNotAllowed = "Duplicate items are not allowed in the collection.";
public const string InvalidOperation_WrongOidInAsnCollection = "AsnEncodedData element in the collection has wrong Oid value: expected = '{0}', actual = '{1}'.";
public const string PlatformNotSupported_CryptographyPkcs = "System.Security.Cryptography.Pkcs is only supported on Windows platforms.";
public const string Cryptography_Der_Invalid_Encoding = "ASN1 corrupted data.";
public const string Cryptography_Invalid_IA5String = "The string contains a character not in the 7 bit ASCII character set.";
public const string Cryptography_UnknownHashAlgorithm = "'{0}' is not a known hash algorithm.";
public const string Cryptography_WriteEncodedValue_OneValueAtATime = "The input to WriteEncodedValue must represent a single encoded value with no trailing data.";
}