// Create an instance of the default DSA implementation. public new static DSA Create() { return((DSA)(CryptoConfig.CreateFromName (CryptoConfig.DSADefault, null))); }
public static new DES?Create(string algName) { return((DES?)CryptoConfig.CreateFromName(algName)); }
public static new ECDsa?Create(string algorithm) { ArgumentNullException.ThrowIfNull(algorithm); return(CryptoConfig.CreateFromName(algorithm) as ECDsa); }
public static new RSA Create(String algName) { return((RSA)CryptoConfig.CreateFromName(algName)); }
static public HashAlgorithm Create(String hashName) { return((HashAlgorithm)CryptoConfig.CreateFromName(hashName)); }
public static new SHA1 Create(string hashName) { return((SHA1)CryptoConfig.CreateFromName(hashName)); }
/// <summary> /// Создание объекта, реализуещего алгоритм шифрования ГОСТ-28147. /// </summary> /// /// <returns>Криптографический объект, реализующий алгоритм ГОСТ /// 28147.</returns> /// /// <remarks><para>Создание объекта алгоритма шифрования ГОСТ 28147. /// Объект может использоваться /// для симметричного зашифрования и расшифрования.</para></remarks> /// ///// <doc-sample path="Simple\Encrypt" name="EncryptDecryptRandomFile" ///// region="EncryptDecryptRandomFile">Пример зашифрования и ///// расшифрования файла при помощи ///// порожденного класса <see cref="Gost28147CryptoServiceProvider"/>. ///// </doc-sample> public new static Gost28147 Create() { // Создание объекта идет по конфигурации для алгоритма заданного // полным именем класса Gost28147. return((Gost28147)CryptoConfig.CreateFromName(typeof(Gost28147).Name)); }
// Create a symmetric algorithm object. public static SymmetricAlgorithm Create() { return((SymmetricAlgorithm) (CryptoConfig.CreateFromName (CryptoConfig.SymmetricDefault, null))); }
public static new Rijndael?Create(string algName) { return((Rijndael?)CryptoConfig.CreateFromName(algName)); }
/// <summary>Creates an instance of the specified implementation of a keyed hash algorithm.</summary> /// <returns>A new instance of the specified keyed hash algorithm.</returns> /// <param name="algName">The keyed hash algorithm implementation to use. The following table shows the valid values for the <paramref name="algName" /> parameter and the algorithms they map to.Parameter valueImplements System.Security.Cryptography.HMAC<see cref="T:System.Security.Cryptography.HMACSHA1" />System.Security.Cryptography.KeyedHashAlgorithm<see cref="T:System.Security.Cryptography.HMACSHA1" />HMACMD5<see cref="T:System.Security.Cryptography.HMACMD5" />System.Security.Cryptography.HMACMD5<see cref="T:System.Security.Cryptography.HMACMD5" />HMACRIPEMD160<see cref="T:System.Security.Cryptography.HMACRIPEMD160" />System.Security.Cryptography.HMACRIPEMD160<see cref="T:System.Security.Cryptography. HMACRIPEMD160" />HMACSHA1<see cref="T:System.Security.Cryptography.HMACSHA1" />System.Security.Cryptography.HMACSHA1<see cref="T:System.Security.Cryptography. HMACSHA1" />HMACSHA256<see cref="T:System.Security.Cryptography.HMACSHA256" />System.Security.Cryptography.HMACSHA256<see cref="T:System.Security.Cryptography.HMACSHA256" />HMACSHA384<see cref="T:System.Security.Cryptography.HMACSHA384" />System.Security.Cryptography.HMACSHA384<see cref="T:System.Security.Cryptography.HMACSHA384" />HMACSHA512<see cref="T:System.Security.Cryptography.HMACSHA512" />System.Security.Cryptography.HMACSHA512<see cref="T:System.Security.Cryptography.HMACSHA512" />MACTripleDES<see cref="T:System.Security.Cryptography. MACTripleDES" />System.Security.Cryptography.MACTripleDES<see cref="T:System.Security.Cryptography.MACTripleDES" /></param> public new static KeyedHashAlgorithm Create(string algName) { return((KeyedHashAlgorithm)CryptoConfig.CreateFromName(algName)); }
public new static SHA384 Create(String algName) { return((SHA384)(CryptoConfig.CreateFromName(algName, null))); }
// Create a new instance of the "SHA384" class. public new static SHA384 Create() { return((SHA384)(CryptoConfig.CreateFromName (CryptoConfig.SHA384Default, null))); }
public static new RC2 Create(string AlgName) { return((RC2)CryptoConfig.CreateFromName(AlgName)); }
public DSASignatureDeformatter() { this._oid = CryptoConfig.MapNameToOID("SHA1"); }
/// <summary> /// Создание объекта, реализующего алгоритм шифрования ГОСТ-28147 /// с заданным именем реализации. /// </summary> /// /// <param name="algName">Имя реализации алгоритма.</param> /// /// <returns>Криптографический объект, реализующий алгоритм /// ГОСТ 28147.</returns> /// ///// <doc-sample path="Simple\Encrypt" name="EncryptDecryptRandomFile" ///// region="EncryptDecryptRandomFile">Пример зашифрования и ///// расшифрования файла при помощи ///// порожденного класса <see cref="Gost28147CryptoServiceProvider"/>. ///// </doc-sample> public new static Gost28147 Create(string algName) { // Создание объекта идет по конфигурации для алгоритма заданного // параметром. return((Gost28147)CryptoConfig.CreateFromName(algName)); }
/// <include file='doc\SHA1.uex' path='docs/doc[@for="SHA1.Create1"]/*' /> new static public SHA1 Create(String hashName) { return((SHA1)CryptoConfig.CreateFromName(hashName)); }
new static public TripleDES Create(String str) { return((TripleDES)CryptoConfig.CreateFromName(str)); }
public static new TripleDES?Create(string str) { return((TripleDES?)CryptoConfig.CreateFromName(str)); }
/// <summary> /// Creates an instance of the specified implementation of the <see cref="RIPEMD160"/> hash algorithm. /// </summary> /// <param name="hashName">The name of the specific implementation of RIPEMD160 to use.</param> /// <returns>A new instance of the specified implementation of RIPEMD160.</returns> public static new RIPEMD160 Create(string hashName) { return((RIPEMD160)CryptoConfig.CreateFromName(hashName)); }
public static new Aes Create(string algName) { return((Aes)CryptoConfig.CreateFromName(algName)); }
public static new MD5?Create(string algName) => (MD5?)CryptoConfig.CreateFromName(algName);
public static new MD5 Create(string algName) { return((MD5)CryptoConfig.CreateFromName(algName)); }
new static public DSA Create(String algName) { return((DSA)CryptoConfig.CreateFromName(algName)); }
public static SymmetricAlgorithm Create(string algName) { return((SymmetricAlgorithm)CryptoConfig.CreateFromName(algName)); }
/// <include file='doc\RandomNumberGenerator.uex' path='docs/doc[@for="RandomNumberGenerator.Create1"]/*' /> static public RandomNumberGenerator Create(String rngName) { return((RandomNumberGenerator)CryptoConfig.CreateFromName(rngName)); }
public static new SHA1 Create(string hashName) => (SHA1)CryptoConfig.CreateFromName(hashName);
/// <include file='doc\RSAPKCS1SignatureFormatter.uex' path='docs/doc[@for="RSAPKCS1SignatureFormatter.CreateSignature"]/*' /> public override byte[] CreateSignature(byte[] rgbHash) { byte[] rgbSig; if (_strOID == null) { throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID")); } if (_rsaKey == null) { throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); } if (rgbHash == null) { throw new ArgumentNullException("rgbHash"); } // // Two cases here -- if we are talking to the CSP version or // if we are talking to some other RSA provider. // if (_rsaKey is RSACryptoServiceProvider) { rgbSig = ((RSACryptoServiceProvider)_rsaKey).SignHash(rgbHash, _strOID); } else { int cb = _rsaKey.KeySize / 8; int cb1; int i; byte[] rgbInput = new byte[cb]; byte[] rgbOid = CryptoConfig.EncodeOID(_strOID); int lenOid = rgbOid.Length; // // We want to pad this to the following format: // // 00 || 01 || FF ... FF || 00 || prefix || Data // // We want basically to ASN 1 encode the OID + hash: // STRUCTURE { // STRUCTURE { // OID <hash algorithm OID> // NULL (0x05 0x00) // this is actually an ANY and contains the parameters of the algorithm specified by the OID, I think // } // OCTET STRING <hashvalue> // } // // Get the correct prefix byte[] rgbPrefix = new byte[lenOid + 8 + rgbHash.Length]; rgbPrefix[0] = 0x30; // a structure follows int tmp = rgbPrefix.Length - 2; rgbPrefix[1] = (byte)tmp; rgbPrefix[2] = 0x30; tmp = rgbOid.Length + 2; rgbPrefix[3] = (byte)tmp; Buffer.InternalBlockCopy(rgbOid, 0, rgbPrefix, 4, lenOid); rgbPrefix[4 + lenOid] = 0x05; rgbPrefix[4 + lenOid + 1] = 0x00; rgbPrefix[4 + lenOid + 2] = 0x04; // an octet string follows rgbPrefix[4 + lenOid + 3] = (byte)rgbHash.Length; Buffer.InternalBlockCopy(rgbHash, 0, rgbPrefix, lenOid + 8, rgbHash.Length); // Construct the whole array cb1 = cb - rgbHash.Length - rgbPrefix.Length; if (cb1 <= 2) { throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_InvalidOID")); } rgbInput[0] = 0; rgbInput[1] = 1; for (i = 2; i < cb1 - 1; i++) { rgbInput[i] = 0xff; } rgbInput[cb1 - 1] = 0; Buffer.InternalBlockCopy(rgbPrefix, 0, rgbInput, cb1, rgbPrefix.Length); Buffer.InternalBlockCopy(rgbHash, 0, rgbInput, cb1 + rgbPrefix.Length, rgbHash.Length); // // Create the signature by applying the private key to // the padded buffer we just created. // rgbSig = _rsaKey.DecryptValue(rgbInput); } return(rgbSig); }
// Create an instance of a specific DSA implementation, by name. public new static DSA Create(String algName) { return((DSA)(CryptoConfig.CreateFromName(algName, null))); }
public override void SetHashAlgorithm(String strName) { _strOID = CryptoConfig.MapNameToOID(strName, OidGroup.HashAlgorithm); }
public void CCToString () { // under normal circumstance there are no need to create a CryptoConfig object // because all interesting stuff are in static methods CryptoConfig cc = new CryptoConfig (); Assert.AreEqual ("System.Security.Cryptography.CryptoConfig", cc.ToString ()); }
public virtual HashAlgorithm CreateDigest() { return((HashAlgorithm)CryptoConfig.CreateFromName(_strDigest)); }