Skip to content

Instantly share code, notes, and snippets.

@vcsjones
Last active Nov 10, 2020
Embed
What would you like to do?
namespace System.Security.Cryptography {
public abstract class AsymmetricAlgorithm : IDisposable {
+ public virtual void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
+ public virtual void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
+ public virtual void ImportFromPem(ReadOnlySpan<char> input);
}
public abstract class DSA : AsymmetricAlgorithm {
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
+ public override void ImportFromPem(ReadOnlySpan<char> input);
}
public abstract class ECDiffieHellman : AsymmetricAlgorithm {
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
+ public override void ImportFromPem(ReadOnlySpan<char> input);
}
public abstract class ECDsa : AsymmetricAlgorithm {
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
+ public override void ImportFromPem(ReadOnlySpan<char> input);
}
public abstract class RSA : AsymmetricAlgorithm {
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
+ public override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
+ public override void ImportFromPem(ReadOnlySpan<char> input);
}
public readonly struct HashAlgorithmName : IEquatable<HashAlgorithmName> {
+ public static HashAlgorithmName FromOid(string oidValue);
+ public static bool TryFromOid(string oidValue, out HashAlgorithmName value);
}
+ public static class PemEncoding {
+ public static PemFields Find(ReadOnlySpan<char> pemData);
+ public static int GetEncodedSize(int labelLength, int dataLength);
+ public static bool TryFind(ReadOnlySpan<char> pemData, out PemFields fields);
+ public static bool TryWrite(ReadOnlySpan<char> label, ReadOnlySpan<byte> data, Span<char> destination, out int charsWritten);
+ public static char[] Write(ReadOnlySpan<char> label, ReadOnlySpan<byte> data);
+ }
+ public readonly struct PemFields {
+ public Range Base64Data { get; }
+ public int DecodedDataLength { get; }
+ public Range Label { get; }
+ public Range Location { get; }
+ }
public abstract class MD5 : HashAlgorithm {
+ public static byte[] HashData(byte[] source);
+ public static byte[] HashData(System.ReadOnlySpan<byte> source);
+ public static int HashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination);
+ public static bool TryHashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten);
}
public abstract class SHA1 : HashAlgorithm {
+ public static byte[] HashData(byte[] source);
+ public static byte[] HashData(System.ReadOnlySpan<byte> source);
+ public static int HashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination);
+ public static bool TryHashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten);
}
public abstract class SHA256 : HashAlgorithm {
+ public static byte[] HashData(byte[] source);
+ public static byte[] HashData(System.ReadOnlySpan<byte> source);
+ public static int HashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination);
+ public static bool TryHashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten);
}
public abstract class SHA384 : HashAlgorithm {
+ public static byte[] HashData(byte[] source);
+ public static byte[] HashData(System.ReadOnlySpan<byte> source);
+ public static int HashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination);
+ public static bool TryHashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten);
}
public abstract class SHA512 : HashAlgorithm {
+ public static byte[] HashData(byte[] source);
+ public static byte[] HashData(System.ReadOnlySpan<byte> source);
+ public static int HashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination);
+ public static bool TryHashData(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten);
}
public class X509Certificate2 : X509Certificate {
+ public static X509Certificate2 CreateFromEncryptedPem(ReadOnlySpan<char> certPem, ReadOnlySpan<char> keyPem, ReadOnlySpan<char> password);
+ public static X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath, ReadOnlySpan<char> password, string? keyPemFilePath = null);
+ public static X509Certificate2 CreateFromPem(ReadOnlySpan<char> certPem, ReadOnlySpan<char> keyPem);
+ public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string? keyPemFilePath = null);
}
public class X509Certificate2Collection : X509Certificate {
+ public void ImportFromPem(ReadOnlySpan<char> certPem);
+ public void ImportFromPemFile(string certPemFilePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment