Пример #1
0
        public static DSA FromCapiKeyBlobDSA(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.FromCapiPublicKeyBlobDSA(blob, offset));
            }
            if (b != 7)
            {
                throw new CryptographicException("Unknown blob format.");
            }
            return(CryptoConvert.FromCapiPrivateKeyBlobDSA(blob, offset));
        }
Пример #2
0
        public static DSA FromCapiKeyBlobDSA(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 6:
                return(CryptoConvert.FromCapiPublicKeyBlobDSA(blob, offset));

            case 7:
                return(CryptoConvert.FromCapiPrivateKeyBlobDSA(blob, offset));

            default:
                throw new CryptographicException("Unknown blob format.");
            }
        }
Пример #3
0
 public static DSA FromCapiPublicKeyBlobDSA(byte[] blob)
 {
     return(CryptoConvert.FromCapiPublicKeyBlobDSA(blob, 0));
 }