Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:14:01+00:00 2026-06-17T05:14:01+00:00

I am currently playing around with encryption in the Windows Runtime. When using certain

  • 0

I am currently playing around with encryption in the Windows Runtime. When using certain encryption algorithms I get either a NotImplementedException (AesCcm, AesGcm) or an ArgumentException (AesEcb, AesEcbPkcs7, DesEcb, DesEcbPkcs7, Rc2Ecb, Rc2EcbPkcs7, Rc4, TripleDesEcb, TripleDesEcbPkcs7).

I use the correct key length for each algorithm (I figured that a wrong key length triggers an ArgumentException). For RC4 I use a key of size 1024 since the key is variable. When using the version without padding I pad the data myself to the block length. I kind of understand that AES with CCM and GCM is obviously not implemented in Windows 8, 64 Bit. But the ArgumentException of the variants with ECB cipher mode and of RC4 are strange.

Here is a sample code:

SymmetricKeyAlgorithmProvider symmetricKeyAlgorithmProvider =
   SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithmNames.AesEcbPkcs7);

byte[] plainText = {1, 2, 3, 4, 5, 6, 7, 9, 9, 0};

const uint keySize = 256;
byte[] key = CryptographicBuffer.GenerateRandom(keySize).ToArray();

uint blockLength = symmetricKeyAlgorithmProvider.BlockLength;
byte[] initializationVector =
   CryptographicBuffer.GenerateRandom(blockLength).ToArray();

CryptographicKey cryptographicKey = 
   symmetricKeyAlgorithmProvider.CreateSymmetricKey(key.AsBuffer());

// This line throws an ArgumentException. The exception gives no hint what
// argument is meant and why the value is invalid.
byte[] cipherText = CryptographicEngine.Encrypt(cryptographicKey,
   plainText.AsBuffer(), initializationVector.AsBuffer()).ToArray();

By the way: I know that ECB is not considered safe. But Microsoft included ECB for certain algorithms. That must have a reason (parallelization or so).

The very same code works using AesCbcPkcs7 for example. A similar code for .NET using AES with ECB and PKCS7, a key length of 256 and an IV sized equal to the block length works as well on the same machine.

What could be meant by the ArgumentException?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:14:02+00:00Added an answer on June 17, 2026 at 5:14 am

    I found the answer to the ArgumentException myself: I passed an initialization vector even for algorithmns that does not make use of it (like ECB cipher modes or RC4). These algorithms require that the initialization vector is passed as null.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently playing around with some app ideas using AirPlay mirroring and a second
I am currently playing around with VB.Net using Visual Studio 2010 (.Net 4.0) and
I'm currently playing around with java.nio , which I haven't been using for a
I'm currently playing around with sideloading of Windows 8 applications in a corporate environment.
I am using MVVm in my WPF application. I am currently playing around with
Currently, playing around with Oracle DB 11g on Windows XP. Logged in as scott
I am currently playing around with node.js and MongoDB using the node-mongo-native driver. I
Im currently playing around with some terrain-generation stuff using OpenGL ES 2.0 on iOS
I'm playing around with emailing from nodeJS (using the nodemailer lib), and I'm currently
I'am currently playing around with MongoDB using its C# driver, trying each method in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.