Edit

Share via


Format-SecureBootUEFI

Formats certificates or hashes into a content object that is returned and creates a file that is ready to be signed.

Syntax

FormatForCertificates

Format-SecureBootUEFI
    -Name <String>
    -SignatureOwner <Guid>
    -CertificateFilePath <String[]>
    [-FormatWithCert]
    [-SignableFilePath <String>]
    [-Time <String>]
    [-AppendWrite]
    [-ContentFilePath <String>]
    [<CommonParameters>]

FormatForHashes

Format-SecureBootUEFI
    -Name <String>
    -SignatureOwner <Guid>
    -Hash <String[]>
    -Algorithm <String>
    [-SignableFilePath <String>]
    [-Time <String>]
    [-AppendWrite]
    [-ContentFilePath <String>]
    [<CommonParameters>]

FormatForDelete

Format-SecureBootUEFI
    -Name <String>
    [-Delete]
    [-SignableFilePath <String>]
    [-Time <String>]
    [<CommonParameters>]

Description

The Format-SecureBootUEFI cmdlet receives certificates or hashes as input and formats the input into a content object that is returned. The Set-SecureBootUEFI cmdlet uses this object to update the variable. If you specify a signable file, this cmdlet creates a file that has the specified name that has to be signed.

This cmdlet runs on both UEFI and BIOS (non-UEFI) computers.

Examples

Example 1: Format a private key

PS C:\> Format-SecureBootUefi -Name PK -SignatureOwner 12345678-1234-1234-1234-123456789abc -CertificateFilePath PK.cer -SignableFilePath GeneratedFileToSign.bin -Time 2011-11-01T13:30:00Z | Format-List
Name        : PK
Time        : 2011-11-01T13:30:00Z
AppendWrite : False
Content     : {232, 102, 87, 60...}

This command formats the private key in PK.cer that is later piped to the Set-SecureBootUEFI cmdlet.

Example 2: Format a hash

PS C:\> Format-SecureBootUEFI -Name DBX -SignatureOwner 12345678-1234-1234-1234-123456789abc -Algorithm SHA256 -Hash 0011223344556677889900112233445566778899001122334455667788990011 -SignableFilePath GeneratedFileToSign.bin -Time 2011-11-01T13:30:00Z -AppendWrite | Format-List
Name        : dbx
Time        : 2011-11-01T13:30:00Z
AppendWrite : True
Content     : {18, 165, 108, 130...}

This command formats the hash to beg appended to the DBX UEFI variable when the result is piped to the Set-SecureBootUEFI cmdlet.

Example 3: Format for a variable to be deleted

PS C:\> Format-SecureBootUEFI -Name KEK -Delete -SignableFilePath GeneratedFileToSign.bin -Time 2011-11-01T13:30:00Z | Format-List
Name        : KEK
Time        : 2011-11-01T13:30:00Z
AppendWrite : False
Content     :

This command formats the KEK UEFI variable being deleted when the result is piped into the Set-SecureBootUEFI cmdlet.

Parameters

-Algorithm

Specifies which algorithm to use if this cmdlet is formatting hashes. The acceptable values for this parameter are: SHA1, SHA256, SHA384, and SHA512.

Parameter properties

Type:String
Default value:None
Accepted values:sha1, sha256, sha384, sha512
Supports wildcards:False
DontShow:False
Aliases:alg

Parameter sets

FormatForHashes
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AppendWrite

Indicates that the contents of the current variable are appended instead of overwritten.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:append

Parameter sets

FormatForCertificates
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FormatForHashes
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CertificateFilePath

Specifies one or more files that each contain a certificate that is used to generate the content object.

If you specify only the name, the file must be in the current working directory. Otherwise, specify the full path of the file.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:c

Parameter sets

FormatForCertificates
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ContentFilePath

Specifies the name of the file that is created and contains the information for the content object that is generated by this cmdlet.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:f

Parameter sets

FormatForCertificates
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FormatForHashes
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Delete

Indicates that this cmdlet creates a content object and the appropriate sign-able file that deletes the variable.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:del

Parameter sets

FormatForDelete
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FormatWithCert

Indicates whether the certificate will be stored or just the public key. If this parameter is set, the whole certificate is stored in the content object.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cert

Parameter sets

FormatForCertificates
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Hash

Specifies an array of hashes that are used to generate the content.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:h

Parameter sets

FormatForHashes
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the UEFI environment variable. The acceptable values for this parameter are: PK, KEK, DB, and DBX.

Parameter properties

Type:String
Default value:None
Accepted values:PK, KEK, db, dbx
Supports wildcards:False
DontShow:False
Aliases:n

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-SignableFilePath

Specifies the file that contains the contents of the data that is ready to be signed.

If only the name is specified, the file must be in the current working directory. Otherwise, specify the full path of the file.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:s

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SignatureOwner

Specifies the GUID of the signature owner.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False
Aliases:g

Parameter sets

FormatForCertificates
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FormatForHashes
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Time

Specifies the timestamp that is used in the signature. Format this value as follows so that it is accepted as a DateTime object:

"2011-11-01T13:30:00Z"

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:t

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

This cmdlet accepts a string that represents the UEFI variable name that may be output from the Get-SecureBootUEFI cmdlet.

Outputs

Microsoft.SecureBoot.Commands.UEFIFormattedVariable

This cmdlet returns a UEFIFormattedVariable object that contains information about the package that is built up to be set. The following members are part of the UEFIFormattedVariable object:

  • A string named Name.
  • A string named Time.
  • A Boolean named AppendWrite.
  • An array of bytes named Content.

The UEFIFormattedVariable object can be used to pipe to the Set-SecureBootUEFI cmdlet.