Example #1
0
    public void Test(string keyHex, string nonceHex, string associatedDataHex, string tagHex, string plainHex, string cipherHex)
    {
        var key = keyHex.FromHex();

        Test(new BcXChaCha20Poly1305Crypto(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
        Test(AEADCryptoCreate.XChaCha20Poly1305(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
    }
Example #2
0
    public void Test(string keyHex, string nonceHex, string associatedDataHex, string tagHex, string plainHex, string cipherHex)
    {
        var key = keyHex.FromHex();

        Test(new DefaultAesGcmCrypto(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
        Test(new BcAesGcmCrypto(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
        Test(new GcmCryptoMode(AESUtils.CreateECB(key)), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
        Test(AEADCryptoCreate.AesGcm(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
    }
Example #3
0
    public void Test(string keyHex, string nonceHex, string associatedDataHex, string tagHex, string plainHex, string cipherHex)
    {
        var key = keyHex.FromHex();

        Test(AEADCryptoCreate.Sm4Gcm(key), nonceHex, associatedDataHex, tagHex, plainHex, cipherHex);
    }
	protected override IAEADCrypto CreateCrypto(ReadOnlySpan<byte> key)
	{
		return AEADCryptoCreate.Sm4Gcm(key);
	}
Example #5
0
 public override void Init(byte[] key, byte[] iv) => crypto = AEADCryptoCreate.AesGcm(key);
Example #6
0
 public override void Init(byte[] key, byte[] iv) => crypto = AEADCryptoCreate.ChaCha20Poly1305(key);
Example #7
0
 public void Encrypt()
 {
     TestEncrypt(AEADCryptoCreate.ChaCha20Poly1305(_randomKey));
 }
 protected override IAEADCrypto CreateCrypto(ReadOnlySpan <byte> key)
 {
     return(AEADCryptoCreate.XChaCha20Poly1305(key));
 }
Example #9
0
 protected override IAEADCrypto CreateCrypto(ReadOnlySpan <byte> key)
 {
     return(AEADCryptoCreate.AesGcm(key));
 }
Example #10
0
 public void SM4GCMEncrypt()
 {
     TestEncrypt(AEADCryptoCreate.Sm4Gcm(_randomKey));
 }