static private FromCapiPrivateKeyBlob ( byte blob, int offset ) : |
||
blob | byte | |
offset | int | |
Результат |
public static RSA FromCapiKeyBlob(byte[] blob, int offset) { if (blob == null) { throw new ArgumentNullException("blob"); } if (offset >= blob.Length) { throw new ArgumentException("blob is too small."); } byte b = blob[offset]; if (b == 6) { return(CryptoConvert.FromCapiPublicKeyBlob(blob, offset)); } if (b != 7) { if (b == 0) { if (blob[offset + 12] == 6) { return(CryptoConvert.FromCapiPublicKeyBlob(blob, offset + 12)); } } throw new CryptographicException("Unknown blob format."); } return(CryptoConvert.FromCapiPrivateKeyBlob(blob, offset)); }
public static RSA FromCapiKeyBlob(byte[] blob, int offset) { if (blob == null) { throw new ArgumentNullException(nameof(blob)); } if (offset >= blob.Length) { throw new ArgumentException("blob is too small."); } switch (blob[offset]) { case 0: if (blob[offset + 12] == (byte)6) { return(CryptoConvert.FromCapiPublicKeyBlob(blob, offset + 12)); } break; case 6: return(CryptoConvert.FromCapiPublicKeyBlob(blob, offset)); case 7: return(CryptoConvert.FromCapiPrivateKeyBlob(blob, offset)); } throw new CryptographicException("Unknown blob format."); }
public static RSA FromCapiPrivateKeyBlob(byte[] blob) { return(CryptoConvert.FromCapiPrivateKeyBlob(blob, 0)); }