New to C++, so apologies if this is an obvious question.

I have a char[], containing an AES key (the key here is for demo only):

```
char oldkey[] = {0x7c, 0x4f, 0xd7, 0xc2, 0xfb, 0x09, 0x1f, 0xef, 0x6d, 0x34, 0x1a, 0x78, 0x6d, 0xd7, 0xb5, 0x17};

```

I'm moving from storing the key in this format to storing a base64 encoded string, which is decoded using CryptStringToBinary:

```
int DecodeBase64( const BYTE * src, unsigned int srcLen, char * dst, unsigned int dstLen ) {
    DWORD outLen;
    BOOL fRet;
    outLen = dstLen;
    fRet = CryptStringToBinary( (LPCSTR) src, srcLen, CRYPT_STRING_BASE64, (BYTE * )dst, &outLen, NULL, NULL);

    if (!fRet) outLen = 0;  // failed
    return( outLen );
}

void * key_mem;
unsigned char key[] = "fE/XwvsJH+9tNBp4bde1Fw=="; //base64 of old_key
unsigned int key_len = sizeof(key);
key_mem = VirtualAlloc(0, key_len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);

DecodeBase64((const BYTE *) key, key_len, (char *) key_mem, key_len);

char* decoded_key = (char*)key_mem;

```

Calling sizeof on decoded\_key and oldkey gives two different results:

```
printf("\n%i\n", sizeof(decoded_key)); //8
printf("\n%i\n", sizeof(oldkey)); //16

```

The data in decoded\_key is correct. It works with my AES algorithm, if I pass the correct key length. How can I get the correct length of decoded\_key (16)?