Skip to content

Commit d970ccf

Browse files
committed
Generate kerberos key from base64 raw key.
1 parent 17d2305 commit d970ccf

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

NtObjectManager/NtObjectManager.psm1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9216,19 +9216,24 @@ function Get-KerberosKey {
92169216
[string]$Password,
92179217
[Parameter(Position = 0, Mandatory, ParameterSetName="FromKey")]
92189218
[byte[]]$Key,
9219+
[Parameter(Mandatory, ParameterSetName="FromBase64Key")]
9220+
[string]$Base64Key,
92199221
[Parameter(Position = 1, Mandatory, ParameterSetName="FromPassword")]
92209222
[Parameter(Position = 1, Mandatory, ParameterSetName="FromKey")]
9223+
[Parameter(Mandatory, ParameterSetName="FromBase64Key")]
92219224
[NtApiDotNet.Win32.Security.Authentication.Kerberos.KerberosEncryptionType]$KeyType,
92229225
[Parameter(ParameterSetName="FromPassword")]
92239226
[int]$Interations = 4096,
92249227
[NtApiDotNet.Win32.Security.Authentication.Kerberos.KerberosNameType]$NameType = "PRINCIPAL",
92259228
[Parameter(Position = 2, Mandatory, ParameterSetName="FromPassword")]
92269229
[Parameter(Position = 2, Mandatory, ParameterSetName="FromKey")]
9230+
[Parameter(Mandatory, ParameterSetName="FromBase64Key")]
92279231
[string]$Principal,
92289232
[Parameter(ParameterSetName="FromPassword")]
92299233
[string]$Salt,
92309234
[uint32]$Version = 1,
92319235
[Parameter(ParameterSetName="FromKey")]
9236+
[Parameter(ParameterSetName="FromBase64Key")]
92329237
[DateTime]$Timestamp = [DateTime]::Now
92339238
)
92349239

@@ -9239,6 +9244,10 @@ function Get-KerberosKey {
92399244
"FromKey" {
92409245
[NtApiDotNet.Win32.Security.Authentication.Kerberos.KerberosKey]::new($KeyType, $Key, $NameType, $Principal, $Timestamp, $Version)
92419246
}
9247+
"FromBase64Key" {
9248+
$Key = [System.Convert]::FromBase64String($Base64Key)
9249+
[NtApiDotNet.Win32.Security.Authentication.Kerberos.KerberosKey]::new($KeyType, $Key, $NameType, $Principal, $Timestamp, $Version)
9250+
}
92429251
}
92439252
$k | Write-Output
92449253
}

0 commit comments

Comments
 (0)