publicKey and privateKey fields may be null. This can occur
when only one half of the key pair is available (e.g., when importing only a public key, or when the private key has been deliberately excluded for security reasons). Callers should check for null before using either field.