Re: Crypto problems in Vista



Thanks, Alun. Calling CryptGetKeyParam() was revealing...

1. The ciphertext is ALWAYS longer than the plaintext. This was my problem.
If the plaintext I encrypt is always 128 bits (16 bytes), there is no need
for padding, but I cannot switch it off. My question was if there is a way
(maybe undocumented) to somehow prevent padding. Padding seems to be always
active, which is a pity. CryptGetKeyParam() returns PKCS5_PADDING (1), no
matter what I select with CryptSetKeyParam().

In ECB mode, at encryption I can just discard the superfluous second block,
but at decryption I have to attach the encrypted 100..0 block (the padding),
which is a hassle.

CFB mode could be used as an AES stream cipher, but it also uses padding, so
no matter, which mode is selected the Vista CSP pads the input.

2. I could not find anywhere documented whether CRYPT_MODE_CTS is supported.
It is not. A call to CryptSetKeyParam with CRYPT_MODE_CTS(5) has no effect. A
subsequent CryptGetKeyParam shows CRYPT_MODE_CBC(1) set.

3. I missed the note in MSDN that OFB is not supported.

All together, the default Vista CSP: “Microsoft Enhanced RSA and AES
Cryptographic Provider” for AES is a disappointment. Padding cannot be
switched off, not even in CFB mode, and CTS and OFB modes are not implemented.
.



Relevant Pages

  • RSA // linking plaintext to ciphertext
    ... >> the plaintext), ... >> ciphertext, ... which is not not the same as the known ciphertext when padding is ... even if encrypt, then sign or sign&encrypt, is used, ...
    (sci.crypt)
  • Re: AES encryption with Java
    ... There is at least one padding byte. ... I'm pretty sure that if you encrypt plaintext that is 16 ... bytes long you should receive ciphertext that is 16 bytes long. ... I'm encrypting 16 byte plaintext and ending up with 32 byte ...
    (comp.lang.java.security)
  • Re: Electronic Codebook/Cipher Block Chaining/Cipher Feedback/ Output Feedback
    ... Then you can snip out the padding after ... file types you encrypt are always in mutliples of 2 and at that you still ... know you gave is the correct keys so this is that data. ... compress this from one of Scott's bijective compressors or what? ...
    (sci.crypt)
  • Re: Padding twice in GCM - why?
    ... to a block boundary with zeros *twice*, first at the end of the ... "AAD", and then again at the end ... lot of padding at the end of the ciphertext. ... In the encrypt direction, a pipelined implementation of GCM (and GCM was ...
    (sci.crypt)
  • RE: AES 128 CryptEncrypt problem ,help me thanks
    ... The reason you see this is because by default block encryption is done with ... If you really want to (eg. you do your own padding and you communicate the ... recommended to use ECB mode. ... BLOCK size which AES_128 can encrypt by once is 16byte. ...
    (microsoft.public.platformsdk.security)