Descrittori di protezione
Una stringa di regola del descrittore di protezione contiene un elenco sequenziale di una o più protezioni. Deve esserci almeno una protezione. Se sono presenti più protezioni, le protezioni devono essere separate nella stringa in base a AND o OR. Questi valori devono essere maiuscole. La sintassi seguente illustra il formato stringa di un descrittore di protezione.
Descriptor = [ Protector-or
*( OR-separator Protector-or ) ]
Protector-or = Protector-and
*( AND-separator Protector-and )
OR-separator = "OR"
AND-separator = "AND"
Protector-and = providerName EQUALS providerAttributes
providerName = descr
providerAttribute = string | hexstring
; The following characters are to be escaped when they appear
; in the value to be encoded: ESC, one of <escaped>, leading
; SHARP or SPACE, trailing SPACE, and NULL.
string = [ ( leadchar / pair ) [ *( stringchar / pair )
( trailchar / pair ) ] ]
leadchar = LUTF1 / UTFMB
LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F
trailchar = TUTF1 / UTFMB
TUTF1 = %x01-1F / %x21 / %x23-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F
stringchar = SUTF1 / UTFMB
SUTF1 = %x01-21 / %x23-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F
pair = ESC ( ESC / special / hexpair )
special = escaped / SPACE / SHARP / EQUALS
escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
hexstring = SHARP 1*hexpair
hexpair = HEX HEX
descr = leadkeychar *keychar
leadkeychar = ALPHA
keychar = ALPHA / DIGIT / HYPHEN
number = DIGIT / ( LDIGIT 1*DIGIT )
ALPHA = %x41-5A / %x61-7A ; "A"-"Z" / "a"-"z"
DIGIT = %x30 / LDIGIT ; "0"-"9"
LDIGIT = %x31-39 ; "1"-"9"
HEX = DIGIT / %x41-46 / %x61-66 ; "0"-"9" / "A"-"F" / "a"-"f"
NULL = %x00 ; null (0)
SPACE = %x20 ; space (" ")
DQUOTE = %x22 ; quote (""")
SHARP = %x23 ; octothorpe (or sharp sign) ("#")
DOLLAR = %x24 ; dollar sign ("$")
SQUOTE = %x27 ; single quote ("'")
LPAREN = %x28 ; left paren ("(")
RPAREN = %x29 ; right paren (")")
PLUS = %x2B ; plus sign ("+")
COMMA = %x2C ; comma (",")
HYPHEN = %x2D ; hyphen ("-")
DOT = %x2E ; period (".")
SEMI = %x3B ; semicolon (";")
LANGLE = %x3C ; left angle bracket ("<")
EQUALS = %x3D ; equals sign ("=")
RANGLE = %x3E ; right angle bracket (">")
ESC = %x5C ; backslash ("\")
USCORE = %x5F ; underscore ("_")
LCURLY = %x7B ; left curly brace "{"
RCURLY = %x7D ; right curly brace "}"
; Any UTF-8 [RFC3629] encoded Unicode [Unicode] character
UTF8 = UTF1 / UTFMB
UTFMB = UTF2 / UTF3 / UTF4
UTF0 = %x80-BF
UTF1 = %x00-7F
UTF2 = %xC2-DF UTF0
UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
%xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
%xF4 %x80-8F 2(UTF0)
OCTET = %x00-FF ; Any octet (8-bit data unit)
I descrittori di protezione possono essere attualmente definiti per i tipi di autorizzazione seguenti:
- Gruppo in una foresta Active Directory.
- Set di credenziali Web.
- Certificato nell'archivio certificati dell'utente.
Di seguito sono riportati alcuni esempi di stringhe di regole del descrittore di protezione per un gruppo di Active Directory:
- "SID=S-1-5-21-4392301 AND SID=S-1-5-21-3101812"
- "SDDL=O:S-1-5-5-0-290724G:SYD:(A;; CCDC;;; S-1-5-5-0-290724)(A;; DC;;; WD)"
- "LOCAL=user"
- "LOCAL=machine"
Di seguito sono riportati alcuni esempi di stringhe di regole del descrittore di protezione per un set di credenziali Web:
- "WEBCREDENTIALS=MyPasswordName"
- "WEBCREDENTIALS=MyPasswordName,myweb.com"
Di seguito sono riportati alcuni esempi di stringhe di regole del descrittore di protezione per un certificato:
- "CERTIFICATE=HashID:sha1_hash_of_certificate"
- "CERTIFICATE=CertBlob:base64String"
Il descrittore di protezione specificato determina automaticamente quale provider di protezione delle chiavi viene usato. Per altre informazioni, vedere Provider di protezione.
Si noti che il lato sinistro del segno di uguale (=) deve essere SID, SDDL, LOCAL, WEBCREDENTIALSo CERTIFICATE. Questi valori non fanno distinzione tra maiuscole e minuscole.
È necessario specificare una stringa di regola (o un nome visualizzato associato a una stringa di regola) quando si chiama la funzione NCryptCreateProtectionDescriptor. In alternativa, poiché le stringhe di regola del descrittore di protezione sono piuttosto complesse da usare e ricordare, è possibile associare un nome visualizzato alla stringa della regola e registrare entrambi usando la funzione NCryptRegisterProtectionDescriptorName. È quindi possibile usare il nome visualizzato in NCryptCreateProtectionDescriptor.
Argomenti correlati