code: def generate_rsa_key_pair(
      private_key_path: Path, public_key_path: Optional[Path] = None
  ):
      if public_key_path is None:
          public_key_path = private_key_path.with_suffix(
              private_key_path.suffix + ".pub"
          )
  
      private_bytes, public_bytes = generate_rsa_key_pair_bytes()
  
      def key_opener(path, flags):
          return os.open(path, flags, 0o600)
  
      with open(private_key_path, "wb", opener=key_opener) as f:
          f.write(private_bytes)
      with open(public_key_path, "wb", opener=key_opener) as f:
          f.write(public_bytes)
  
file_path: dstack/src/dstack/_internal/utils/crypto.py
imports: import os
  from pathlib import Path
  from typing import Optional, Tuple
  from cryptography.hazmat.backends import default_backend
  from cryptography.hazmat.primitives import serialization
  from cryptography.hazmat.primitives.asymmetric import rsa
label_desc: Use image node_id 1 for calling a global function with example usage: generate_rsa_key_pair(private_key_path, public_key_path) and returns: os