Skip to content

Commit 1d89a3a

Browse files
authored
Merge pull request MicrosoftDocs#318 from ragemagic/patch-1
Added description of BRYPT_KDF_RAW_SECRET value + remarks
2 parents 505aecc + 0526056 commit 1d89a3a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sdk-api-src/content/bcrypt/nf-bcrypt-bcryptderivekey.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,14 @@ The call to the KDF is made as shown in the following pseudocode.
442442
KDF_SUPPPRIVINFO)</code></pre>
443443
<b>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  </b>This value is not supported.
444444

445+
#### BCRYPT_KDF_RAW_SECRET (L"TRUNCATE")
446+
447+
Returns the little-endian representation of the raw secret without any modification.
448+
449+
If the <i>cbDerivedKey</i> parameter is less than the size of the derived key, this function will only copy the specified number of bytes to the <i>pbDerivedKey</i> buffer. If the <i>cbDerivedKey</i> parameter is greater than the size of the derived key, this function will copy the key to the <i>pbDerivedKey</i> buffer and set the variable pointed to by the <i>pcbResult</i> to the actual number of bytes copied.
450+
451+
<b>Windows 8, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  </b>This value is not supported.
452+
445453

446454
### -param pParameterList [in, optional]
447455

@@ -589,6 +597,9 @@ Value: {0x04, 0x05, 0x20, 0x21, 0x22, 0x23}, length 6
589597
Type: KDF_SECRET_APPEND
590598
Value: {0x01, 0x10, 0x11, 0x12}, length 4
591599
</code></pre>
600+
601+
If the <i>pwszKDF</i> parameter is set to <b>BCRYPT_KDF_RAW_SECRET</b>, The returned secret (unlike the other <i>pwszKDF</i> values) will be encoded in little-endian format. It is important to take note of this when using the raw secret in any other CNG functions, as most of them take in big-endian encoded inputs.
602+
592603
Depending on what processor modes a provider supports, <b>BCryptDeriveKey</b> can be called either from user mode or kernel mode. Kernel mode callers can execute either at <b>PASSIVE_LEVEL</b> <a href="https://docs.microsoft.com/windows/desktop/SecGloss/i-gly">IRQL</a> or <b>DISPATCH_LEVEL</b> IRQL. If the current IRQL level is <b>DISPATCH_LEVEL</b>, the handle provided in the <i>hSharedSecret</i> parameter must be located in nonpaged (or locked) memory and must be derived from an algorithm handle returned by a provider that was opened by using the <b>BCRYPT_PROV_DISPATCH</b> flag.
593604
594605
To call this function in kernel mode, use Cng.lib, which is part of the Driver Development Kit (DDK). <b>Windows Server 2008 and Windows Vista:  </b>To call this function in kernel mode, use Ksecdd.lib.

0 commit comments

Comments
 (0)