public static KeyParameter MakeCamelliaKey( int keySize) { camelliaKg.Init(new KeyGenerationParameters(rand, keySize)); return(ParameterUtilities.CreateKeyParameter("CAMELLIA", camelliaKg.GenerateKey())); }
public override ProtobufPacket Handle(EncryptionRequestPacket packet) { var generator = new CipherKeyGenerator(); generator.Init(new KeyGenerationParameters(new SecureRandom(), 16 * 8)); var sharedKey = generator.GenerateKey(); var hash = GetServerIDHash(packet.PublicKey, sharedKey, packet.ServerID); if (!Yggdrasil.JoinSession(Context.AccessToken, Context.SelectedProfile, hash).Result.Response) { throw new Exception("Yggdrasil error: Not authenticated."); } var signer = new PKCS1Signer(packet.PublicKey); Context.SendPacket(new EncryptionResponsePacket { SharedSecret = signer.SignData(sharedKey), VerifyToken = signer.SignData(packet.VerifyToken) }); Context.Stream.InitializeEncryption(sharedKey); return(null); }
private static CipherKeyGenerator CreateCipherKeyGenerator(SecureRandom random, int keySize) { CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.Init(new KeyGenerationParameters(random, keySize)); return(keyGen); }
/// <summary> /// Generate a key. /// </summary> /// <returns>An AES key.</returns> public FipsAes.Key GenerateKey() { CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator(); cipherKeyGenerator.Init(new Internal.KeyGenerationParameters(random, keySizeInBits)); return(new Key(cipherKeyGenerator.GenerateKey())); }
public Stream Open(Stream outStream, string encryptionOid) { CipherKeyGenerator keyGenerator = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGenerator.Init(new KeyGenerationParameters(this.rand, keyGenerator.DefaultStrength)); return(this.Open(outStream, encryptionOid, keyGenerator)); }
public Stream Open(Stream outStream, string encryptionOid, int keySize) { CipherKeyGenerator keyGenerator = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGenerator.Init(new KeyGenerationParameters(rand, keySize)); return(Open(outStream, encryptionOid, keyGenerator)); }
public static string GenerateSerpentKey() { var ckg = new CipherKeyGenerator(); ckg.Init(new KeyGenerationParameters(new SecureRandom(), 256)); return(ckg.GenerateKey().ToHexString()); }
public static KeyParameter MakeAesKey( int keySize) { aesKg.Init(new KeyGenerationParameters(rand, keySize)); return(ParameterUtilities.CreateKeyParameter("AES", aesKg.GenerateKey())); }
static TspTestUtil() { rand = new SecureRandom(); kpg = GeneratorUtilities.GetKeyPairGenerator("RSA"); kpg.Init(new RsaKeyGenerationParameters( BigInteger.ValueOf(0x10001), rand, 1024, 25)); desede128kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede128kg.Init(new KeyGenerationParameters(rand, 112)); desede192kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede192kg.Init(new KeyGenerationParameters(rand, 168)); rc240kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc240kg.Init(new KeyGenerationParameters(rand, 40)); rc264kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc264kg.Init(new KeyGenerationParameters(rand, 64)); rc2128kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc2128kg.Init(new KeyGenerationParameters(rand, 128)); serialNumber = BigInteger.One; }
private byte[] GenerateKey() { CipherKeyGenerator keygen = new CipherKeyGenerator(); SecureRandom rand = new SecureRandom(); KeyGenerationParameters keygenParams = new KeyGenerationParameters(rand, this.KeySize); keygen.Init(keygenParams); return(keygen.GenerateKey()); }
private static string InitKey(SecureRandom rnd) { KeyGenerationParameters keyGenParams = new KeyGenerationParameters(rnd, 24 * 8); CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.Init(keyGenParams); byte[] buf = keyGen.GenerateKey(); return(Base64.Encode(buf)); }
public static IKey GenerateDESKey(short keyLength) { CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator(); cipherKeyGenerator.Init(new KeyGenerationParameters(new SecureRandom(), keyLength)); byte[] keyDES3 = cipherKeyGenerator.GenerateKey(); return(FormDESKey(keyLength, keyDES3)); }
private static string Generate_Sim_Key() { var keygen = new CipherKeyGenerator(); keygen.Init(new KeyGenerationParameters(new SecureRandom(), 256)); var key = Convert.ToBase64String(keygen.GenerateKey()); return(key); }
//private void BtnDecrypt_Loaded(object sender, RoutedEventArgs e) //{ // if (String.IsNullOrEmpty(textBoxDecryptInputFile.Text) || String.IsNullOrEmpty(textBoxDecryptOutputFile.Text) // || String.IsNullOrEmpty(PasswordDecrypt.Password) || ComboBoxRecipient.ItemsSource == null) // DecryptBtn.IsEnabled = false; // else // DecryptBtn.IsEnabled = true; //} //private void BtnDecrypt_Loaded(object sender, SelectionChangedEventArgs e) //{ // var who = ComboBoxRecipient.SelectedItem as Recipient; // if (who != null) // { // inputKeyFile = @".\prywatne\" + who.Name; // } //} private byte[] RSADecrypt(byte[] toDecrypt) { AsymmetricKeyParameter keyPriv; var bytesToDecrypt = toDecrypt; var sec = new SecureRandom(); PgpSecretKey pgpPriv; using (Stream sr = File.OpenRead(inputKeyFile)) { pgpPriv = PGPKey.ImportSecretKey(sr); } var pass = PasswordDecrypt.Password.ToCharArray(); try { keyPriv = pgpPriv.ExtractPrivateKey(pass).Key; } catch { keyPriv = null; } if (keyPriv == null) { byte[] seed = Encoding.UTF8.GetBytes(pass); var sec2 = new SecureRandom(seed); var keyParam = new KeyGenerationParameters(sec2, Int32.Parse(metadataDecrypt.KeySize)); var keyGenerator = new CipherKeyGenerator(); keyGenerator.Init(keyParam); return(keyGenerator.GenerateKey()); } var decryptEngine = new Pkcs1Encoding(new RsaEngine()); decryptEngine.Init(false, keyPriv); byte[] decrypted; try { decrypted = decryptEngine.ProcessBlock(bytesToDecrypt, 0, bytesToDecrypt.Length); } catch { var keyParam = new KeyGenerationParameters(sec, Int32.Parse(metadataDecrypt.KeySize)); var keyGenerator = new CipherKeyGenerator(); keyGenerator.Init(keyParam); return(keyGenerator.GenerateKey()); } return(decrypted); }
/// **************************************************************************** /// Encryption and Decryption Algorithms /// **************************************************************************** public byte[] Encrypt_Serpent(string plainMessage) { CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator(); cipherKeyGenerator.Init(new KeyGenerationParameters(new SecureRandom(), 128)); byte[] key = cipherKeyGenerator.GenerateKey(); byte [] iv = cipherKeyGenerator.GenerateKey(); byte[] encrptedDAta = SerpentAlgo.SerpentEncryption(plainMessage, key); return(encrptedDAta.Concat(key).Concat(iv).ToArray()); }
/** * generate an enveloped object that contains an CMS Enveloped Data object */ public Stream Open( Stream outStr, string encryptionOid) { CipherKeyGenerator keyGen = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGen.Init(new KeyGenerationParameters(rand, keyGen.DefaultStrength)); return Open(outStr, encryptionOid, keyGen); }
public static void GenerateSymKey(int keyLength) { var sec = new SecureRandom(); sec.SetSeed(DateTime.Now.ToBinary()); var keyParam = new KeyGenerationParameters(sec, keyLength); var keyGenerator = new CipherKeyGenerator(); keyGenerator.Init(keyParam); symKey = keyGenerator.GenerateKey(); }
public static KeyParameter generateKey(int keySize) { // проверка параметра keySize //@todo CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.Init(new KeyGenerationParameters(new SecureRandom(), keySize)); byte[] sessionKey = keyGen.GenerateKey(); var param = generateKeyFromBytes(sessionKey); return(param); }
public CmsEnvelopedData Generate(CmsProcessable content, string encryptionOid, int keySize) { try { CipherKeyGenerator keyGenerator = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGenerator.Init(new KeyGenerationParameters(rand, keySize)); return(Generate(content, encryptionOid, keyGenerator)); } catch (SecurityUtilityException e) { throw new CmsException("can't find key generation algorithm.", e); } }
public static byte[] generateIV(bool zeros = false) { byte[] iv; if (!zeros) { CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.Init(new KeyGenerationParameters(new SecureRandom(), BLOCK_SIZE << 3)); iv = keyGen.GenerateKey(); } else { iv = new byte[BLOCK_SIZE]; } return(iv); }
public CmsAuthenticatedData Generate(CmsProcessable content, string encryptionOid) { CmsAuthenticatedData result; try { CipherKeyGenerator keyGenerator = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGenerator.Init(new KeyGenerationParameters(this.rand, keyGenerator.DefaultStrength)); result = this.Generate(content, encryptionOid, keyGenerator); } catch (SecurityUtilityException e) { throw new CmsException("can't find key generation algorithm.", e); } return(result); }
// Performs AES encryption with Bouncy Castle and returns the encrypted data along with the secret key public static string[] Encrypt(string data) { var keyGenerator = new CipherKeyGenerator(); keyGenerator.Init(new KeyGenerationParameters(new SecureRandom(), 256)); var secretKey = keyGenerator.GenerateKey(); var dataBytes = Encoding.UTF8.GetBytes(data); BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CbcBlockCipher(new AesEngine())); cipher.Init(true, new KeyParameter(secretKey)); var rv = new byte[cipher.GetOutputSize(dataBytes.Length)]; var tam = cipher.ProcessBytes(dataBytes, 0, dataBytes.Length, rv, 0); cipher.DoFinal(rv, tam); return(new[] { Hex.ToHexString(rv), Hex.ToHexString(secretKey) }); }
/** * generate an enveloped object that contains an CMS Enveloped Data object * @throws IOException */ public Stream Open( Stream outStream, string encryptionOid, int keySize) { try { CipherKeyGenerator keyGen = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGen.Init(new KeyGenerationParameters(rand, keySize)); return(Open(outStream, encryptionOid, keyGen)); } catch (SecurityUtilityException e) { throw new CmsException("can't find key generation algorithm.", e); } }
/** * generate an authenticated object that contains an CMS Authenticated Data object */ public CmsAuthenticatedData Generate( CmsProcessable content, string encryptionOid) { try { // FIXME Will this work for macs? CipherKeyGenerator keyGen = GeneratorUtilities.GetKeyGenerator(encryptionOid); keyGen.Init(new KeyGenerationParameters(rand, keyGen.DefaultStrength)); return(Generate(content, encryptionOid, keyGen)); } catch (SecurityUtilityException e) { throw new CmsException("can't find key generation algorithm.", e); } }
public void SerpentTest() { CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator(); cipherKeyGenerator.Init(new KeyGenerationParameters(new SecureRandom(), 128)); byte[] key = cipherKeyGenerator.GenerateKey(); string message = "Hello World!"; // Encrypt the string to an in-memory buffer. byte[] encrptedDAta = SerpentAlgo.SerpentEncryption(message, key); // Decrypt the buffer back to a string. string plainText = SerpentAlgo.SerpentDecryption(encrptedDAta, key); // Display the decrypted string to the console. Console.WriteLine(plainText); }
private void button9_Click(object sender, RoutedEventArgs e) //Generiraj 3DES ključ { CipherKeyGenerator generatorKljuča = new CipherKeyGenerator(); generatorKljuča.Init(new KeyGenerationParameters(new SecureRandom(), 112)); ključ3DES = generatorKljuča.GenerateKey(); BigInteger bigInteger = new BigInteger(ključ3DES); Microsoft.Win32.SaveFileDialog shrani3DESKljuč = new Microsoft.Win32.SaveFileDialog(); shrani3DESKljuč.Title = "Shrani 3DES ključ"; shrani3DESKljuč.Filter = "txt files(*.txt) | *.txt"; var naŠestnajstZnakov = bigInteger.ToString(16).Substring(0, 16); if (shrani3DESKljuč.ShowDialog() == true) { File.WriteAllText(shrani3DESKljuč.FileName, naŠestnajstZnakov); } }
public static byte[] generateIV(bool zeros = false) { byte[] iv; if (!zeros) { CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.Init(new KeyGenerationParameters(new SecureRandom(), BLOCK_SIZE << 3)); iv = keyGen.GenerateKey(); } else { iv = new byte[BLOCK_SIZE]; } ////@todo delete this //System.Console.WriteLine("iv: {0}", BitConverter.ToString(iv)); return(iv); }
static CmsTestUtil() { try { rand = new SecureRandom(); aes192kg = GeneratorUtilities.GetKeyGenerator("AES"); aes192kg.Init(new KeyGenerationParameters(rand, 192)); desede128kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede128kg.Init(new KeyGenerationParameters(rand, 112)); desede192kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede192kg.Init(new KeyGenerationParameters(rand, 168)); rc240kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc240kg.Init(new KeyGenerationParameters(rand, 40)); rc264kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc264kg.Init(new KeyGenerationParameters(rand, 64)); rc2128kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc2128kg.Init(new KeyGenerationParameters(rand, 128)); aesKg = GeneratorUtilities.GetKeyGenerator("AES"); seedKg = GeneratorUtilities.GetKeyGenerator("SEED"); camelliaKg = GeneratorUtilities.GetKeyGenerator("Camellia"); serialNumber = BigInteger.One; } catch (Exception ex) { throw new Exception(ex.ToString()); } }
// TODO Make private again and call from PerformTest public void doTestExceptions() { // TODO Put back in // SecretKeyFactory skF = null; // // try // { // skF = SecretKeyFactory.getInstance("DESede"); // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } // // KeySpec ks = null; // SecretKey secKey = null; // byte[] bb = new byte[24]; // // try // { // skF.getKeySpec(null, null); // // Fail("failed exception test - no exception thrown"); // } // catch (InvalidKeySpecException e) // { // // ignore okay // } // catch (Exception e) // { // Fail("failed exception test.", e); // } // try // { // ks = (KeySpec)new DESedeKeySpec(bb); // skF.getKeySpec(null, ks.getClass()); // // Fail("failed exception test - no exception thrown"); // } // catch (InvalidKeySpecException e) // { // // ignore okay; // } // catch (Exception e) // { // Fail("failed exception test.", e); // } // try // { // skF.getKeySpec(secKey, null); // } // catch (InvalidKeySpecException e) // { // // ignore okay // } // catch (Exception e) // { // Fail("failed exception test.", e); // } try { CipherKeyGenerator kg = GeneratorUtilities.GetKeyGenerator("DESede"); try { kg.Init(new KeyGenerationParameters(new SecureRandom(), int.MinValue)); Fail("failed exception test - no exception thrown"); } // catch (InvalidParameterException) catch (ArgumentException) { // ignore okay } catch (Exception e) { Fail("failed exception test.", e); } } catch (Exception e) { Fail("unexpected exception.", e); } // TODO Put back in // try // { // skF = SecretKeyFactory.getInstance("DESede"); // // try // { // skF.translateKey(null); // // Fail("failed exception test - no exception thrown"); // } // catch (InvalidKeyException) // { // // ignore okay // } // catch (Exception e) // { // Fail("failed exception test.", e); // } // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } // try // { // byte[] rawDESKey = { (byte)128, (byte)131, (byte)133, (byte)134, // (byte)137, (byte)138, (byte)140, (byte)143 }; // //// SecretKeySpec cipherKey = new SecretKeySpec(rawDESKey, "DES"); // KeyParameter cipherKey = new DesParameters(rawDESKey); // // IBufferedCipher cipher = CipherUtilities.GetCipher("DES/CBC/NoPadding"); // // try // { // // According specification engineInit(int opmode, Key key, // // SecureRandom random) throws InvalidKeyException if this // // cipher is being // // initialized for decryption and requires algorithm parameters // // that cannot be determined from the given key //// cipher.Init(false, cipherKey, (SecureRandom)null); // cipher.Init(false, new ParametersWithRandom(cipherKey, new SecureRandom())); // // Fail("failed exception test - no InvalidKeyException thrown"); // } // catch (InvalidKeyException) // { // // ignore // } // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } try { // byte[] rawDESKey = { -128, -125, -123, -122, -119, -118 }; byte[] rawDESKey = { 128, 131, 133, 134, 137, 138 }; // SecretKeySpec cipherKey = new SecretKeySpec(rawDESKey, "DES"); // IBufferedCipher cipher = CipherUtilities.GetCipher("DES/ECB/NoPadding"); try { KeyParameter cipherKey = new DesParameters(rawDESKey); // According specification engineInit(int opmode, Key key, // SecureRandom random) throws InvalidKeyException if the given // key is inappropriate for initializing this cipher // cipher.Init(true, cipherKey); // Fail("failed exception test - no InvalidKeyException thrown"); Fail("failed exception test - no ArgumentException thrown"); } // catch (InvalidKeyException) catch (ArgumentException) { // ignore } } catch (Exception e) { Fail("unexpected exception.", e); } // try // { //// byte[] rawDESKey = { -128, -125, -123, -122, -119, -118, -117, -115, -114 }; // byte[] rawDESKey = { 128, 131, 133, 134, 137, 138, 139, 141, 142 }; // //// SecretKeySpec cipherKey = new SecretKeySpec(rawDESKey, "DES"); // KeyParameter cipherKey = new DesParameters(rawDESKey); // // IBufferedCipher cipher = CipherUtilities.GetCipher("DES/ECB/NoPadding"); // try // { // // According specification engineInit(int opmode, Key key, // // SecureRandom random) throws InvalidKeyException if the given // // key is inappropriate for initializing this cipher // cipher.Init(true, cipherKey); // // Fail("failed exception test - no InvalidKeyException thrown"); // } // catch (InvalidKeyException) // { // // ignore // } // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } try { byte[] rawDESKey = { (byte)128, (byte)131, (byte)133, (byte)134, (byte)137, (byte)138, (byte)140, (byte)143 }; // SecretKeySpec cipherKey = new SecretKeySpec(rawDESKey, "DES"); KeyParameter cipherKey = new DesParameters(rawDESKey); IBufferedCipher ecipher = CipherUtilities.GetCipher("DES/ECB/PKCS5Padding"); ecipher.Init(true, cipherKey); byte[] cipherText = new byte[0]; try { // According specification Method engineUpdate(byte[] input, // int inputOffset, int inputLen, byte[] output, int // outputOffset) // throws ShortBufferException - if the given output buffer is // too // small to hold the result // ecipher.update(new byte[20], 0, 20, cipherText); ecipher.ProcessBytes(new byte[20], 0, 20, cipherText, 0); // Fail("failed exception test - no ShortBufferException thrown"); Fail("failed exception test - no DataLengthException thrown"); } // catch (ShortBufferException) catch (DataLengthException) { // ignore } } catch (Exception e) { Fail("unexpected exception.", e); } // TODO Put back in // try // { // KeyGenerator keyGen = KeyGenerator.getInstance("DES"); // // keyGen.init((SecureRandom)null); // // // According specification engineGenerateKey() doesn't throw any exceptions. // // SecretKey key = keyGen.generateKey(); // if (key == null) // { // Fail("key is null!"); // } // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } // // try // { // AlgorithmParameters algParams = AlgorithmParameters.getInstance("DES"); // // algParams.init(new IvParameterSpec(new byte[8])); // // // According specification engineGetEncoded() returns // // the parameters in their primary encoding format. The primary // // encoding // // format for parameters is ASN.1, if an ASN.1 specification for // // this type // // of parameters exists. // byte[] iv = algParams.getEncoded(); // // if (iv.Length!= 10) // { // Fail("parameters encoding wrong length - " + iv.Length); // } // } // catch (Exception e) // { // Fail("unexpected exception.", e); // } try { try { // AlgorithmParameters algParams = AlgorithmParameters.getInstance("DES"); byte[] encoding = new byte[10]; encoding[0] = 3; encoding[1] = 8; // algParams.init(encoding, "ASN.1"); ParameterUtilities.GetCipherParameters( "AES", ParameterUtilities.CreateKeyParameter("AES", new byte[16]), Asn1Object.FromByteArray(encoding)); // Fail("failed exception test - no IOException thrown"); Fail("failed exception test - no Exception thrown"); } // catch (IOException) catch (ArgumentException) { // okay } // try // { // IBufferedCipher c = CipherUtilities.GetCipher("DES"); // // Key k = new PublicKey() // { // // public string getAlgorithm() // { // return "STUB"; // } // // public string getFormat() // { // return null; // } // // public byte[] getEncoded() // { // return null; // } // // }; // // c.Init(true, k); // // Fail("failed exception test - no InvalidKeyException thrown for public key"); // } // catch (InvalidKeyException e) // { // // okay // } // // try // { // IBufferedCipher c = CipherUtilities.GetCipher("DES"); // // Key k = new PrivateKey() // { // // public string getAlgorithm() // { // return "STUB"; // } // // public string getFormat() // { // return null; // } // // public byte[] getEncoded() // { // return null; // } // // }; // // c.Init(false, k); // // Fail("failed exception test - no InvalidKeyException thrown for private key"); // } // catch (InvalidKeyException e) // { // // okay // } } catch (Exception e) { Fail("unexpected exception.", e); } }
static TspTestUtil() { rand = new SecureRandom(); kpg = GeneratorUtilities.GetKeyPairGenerator("RSA"); kpg.Init(new RsaKeyGenerationParameters( BigInteger.ValueOf(0x10001), rand, 1024, 25)); desede128kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede128kg.Init(new KeyGenerationParameters(rand, 112)); desede192kg = GeneratorUtilities.GetKeyGenerator("DESEDE"); desede192kg.Init(new KeyGenerationParameters(rand, 168)); rc240kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc240kg.Init(new KeyGenerationParameters(rand, 40)); rc264kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc264kg.Init(new KeyGenerationParameters(rand, 64)); rc2128kg = GeneratorUtilities.GetKeyGenerator("RC2"); rc2128kg.Init(new KeyGenerationParameters(rand, 128)); serialNumber = BigInteger.One; AddEntries(NistObjectIdentifiers.DsaWithSha224, "SHA224", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha256, "SHA256", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha384, "SHA384", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha512, "SHA512", "DSA"); AddEntries(OiwObjectIdentifiers.DsaWithSha1, "SHA1", "DSA"); AddEntries(OiwObjectIdentifiers.MD4WithRsa, "MD4", "RSA"); AddEntries(OiwObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA"); AddEntries(OiwObjectIdentifiers.MD5WithRsa, "MD5", "RSA"); AddEntries(OiwObjectIdentifiers.Sha1WithRsa, "SHA1", "RSA"); AddEntries(PkcsObjectIdentifiers.MD2WithRsaEncryption, "MD2", "RSA"); AddEntries(PkcsObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA"); AddEntries(PkcsObjectIdentifiers.MD5WithRsaEncryption, "MD5", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha1WithRsaEncryption, "SHA1", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha224WithRsaEncryption, "SHA224", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha256WithRsaEncryption, "SHA256", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha384WithRsaEncryption, "SHA384", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha512WithRsaEncryption, "SHA512", "RSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha1, "SHA1", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha224, "SHA224", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha256, "SHA256", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha384, "SHA384", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha512, "SHA512", "ECDSA"); AddEntries(X9ObjectIdentifiers.IdDsaWithSha1, "SHA1", "DSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_1, "SHA1", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_224, "SHA224", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_1, "SHA1", "RSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1"); AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1"); encryptionAlgs.Add(X9ObjectIdentifiers.IdDsa.Id, "DSA"); encryptionAlgs.Add(PkcsObjectIdentifiers.RsaEncryption.Id, "RSA"); encryptionAlgs.Add(TeleTrusTObjectIdentifiers.TeleTrusTRsaSignatureAlgorithm.Id, "RSA"); encryptionAlgs.Add(X509ObjectIdentifiers.IdEARsa.Id, "RSA"); encryptionAlgs.Add(EncryptionRsaPss, "RSAandMGF1"); encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x94.Id, "GOST3410"); encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x2001.Id, "ECGOST3410"); encryptionAlgs.Add("1.3.6.1.4.1.5849.1.6.2", "ECGOST3410"); encryptionAlgs.Add("1.3.6.1.4.1.5849.1.1.5", "GOST3410"); digestAlgs.Add(PkcsObjectIdentifiers.MD2.Id, "MD2"); digestAlgs.Add(PkcsObjectIdentifiers.MD4.Id, "MD4"); digestAlgs.Add(PkcsObjectIdentifiers.MD5.Id, "MD5"); digestAlgs.Add(OiwObjectIdentifiers.IdSha1.Id, "SHA1"); digestAlgs.Add(NistObjectIdentifiers.IdSha224.Id, "SHA224"); digestAlgs.Add(NistObjectIdentifiers.IdSha256.Id, "SHA256"); digestAlgs.Add(NistObjectIdentifiers.IdSha384.Id, "SHA384"); digestAlgs.Add(NistObjectIdentifiers.IdSha512.Id, "SHA512"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD128.Id, "RIPEMD128"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD160.Id, "RIPEMD160"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD256.Id, "RIPEMD256"); digestAlgs.Add(CryptoProObjectIdentifiers.GostR3411.Id, "GOST3411"); digestAlgs.Add("1.3.6.1.4.1.5849.1.2.1", "GOST3411"); digestAliases.Add("SHA1", new string[] { "SHA-1" }); digestAliases.Add("SHA224", new string[] { "SHA-224" }); digestAliases.Add("SHA256", new string[] { "SHA-256" }); digestAliases.Add("SHA384", new string[] { "SHA-384" }); digestAliases.Add("SHA512", new string[] { "SHA-512" }); noParams.Add(EncryptionDsa); //noParams.Add(EncryptionECDsa); noParams.Add(EncryptionECDsaWithSha1); noParams.Add(EncryptionECDsaWithSha224); noParams.Add(EncryptionECDsaWithSha256); noParams.Add(EncryptionECDsaWithSha384); noParams.Add(EncryptionECDsaWithSha512); ecAlgorithms.Add(DigestSha1, EncryptionECDsaWithSha1); ecAlgorithms.Add(DigestSha224, EncryptionECDsaWithSha224); ecAlgorithms.Add(DigestSha256, EncryptionECDsaWithSha256); ecAlgorithms.Add(DigestSha384, EncryptionECDsaWithSha384); ecAlgorithms.Add(DigestSha512, EncryptionECDsaWithSha512); }