/* Enroll new KEK into the System without PK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */
EFI_STATUS EnrollKeyExchangeKey(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private)
/* Enroll new KEK into the System without PK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */
EFI_STATUS EnrollKeyExchangeKey(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private)
{
  UINT16      *FilePostFix;
  EFI_STATUS  Status;
  UINTN       NameLength;
  if ((Private->FileContext->FHandle == NULL) || (Private->FileContext->FileName == NULL) || (Private->SignatureGUID == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Status = SetSecureBootMode (CUSTOM_SECURE_BOOT_MODE);
  if (EFI_ERROR (Status)) {
    return Status;
  }
  NameLength = StrLen (Private->FileContext->FileName);
  if (NameLength <= 4) {
    return EFI_INVALID_PARAMETER;
  }
  FilePostFix = Private->FileContext->FileName + NameLength - 4;
  if (IsDerEncodeCertificate (FilePostFix)) {
    return EnrollX509ToKek (Private);
  } else if (CompareMem (FilePostFix, L".pbk", 4) == 0) {
    return EnrollRsa2048ToKek (Private);
  } else {
    CloseEnrolledFile (Private->FileContext);
    return EFI_INVALID_PARAMETER;
  }
}