StrongNameKeyPair.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. throw new PlatformNotSupportedException();
  27. public StrongNameKeyPair(string keyPairContainer) =>
  28. throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
  29. public byte[] PublicKey =>
  30. throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
  31. void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) =>
  32. throw new PlatformNotSupportedException();
  33. void IDeserializationCallback.OnDeserialization(object? sender) =>
  34. throw new PlatformNotSupportedException();
  35. }
  36. }