StrongNameKeyPair.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.IO;
  5. using System.Runtime.Serialization;
  6. namespace System.Reflection
  7. {
  8. public class StrongNameKeyPair : IDeserializationCallback, ISerializable
  9. {
  10. // Build key pair from file.
  11. public StrongNameKeyPair(FileStream keyPairFile)
  12. {
  13. if (keyPairFile == null)
  14. throw new ArgumentNullException(nameof(keyPairFile));
  15. int length = (int)keyPairFile.Length;
  16. byte[] keyPairArray = new byte[length];
  17. keyPairFile.Read(keyPairArray, 0, length);
  18. }
  19. // Build key pair from byte array in memory.
  20. public StrongNameKeyPair(byte[] keyPairArray)
  21. {
  22. if (keyPairArray == null)
  23. throw new ArgumentNullException(nameof(keyPairArray));
  24. }
  25. protected StrongNameKeyPair(SerializationInfo info, StreamingContext context)
  26. {
  27. throw new PlatformNotSupportedException();
  28. }
  29. public StrongNameKeyPair(string keyPairContainer)
  30. {
  31. throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
  32. }
  33. public byte[] PublicKey
  34. {
  35. get
  36. {
  37. throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
  38. }
  39. }
  40. void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
  41. {
  42. throw new PlatformNotSupportedException();
  43. }
  44. void IDeserializationCallback.OnDeserialization(object sender)
  45. {
  46. throw new PlatformNotSupportedException();
  47. }
  48. }
  49. }