> For the complete documentation index, see [llms.txt](https://docs.teleskope.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.teleskope.ai/connectors/saas/snowflake/key-pair-authentication.md).

# Key Pair Authentication

{% stepper %}
{% step %}
**Generate an Unencrypted or Encrypted Private Key**

* Unencrypted Private Key:

{% code overflow="wrap" %}

```sh
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
```

{% endcode %}

* Encrypted Private Key:

{% code overflow="wrap" %}

```sh
openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 des3 -inform PEM -out rsa_key.p8
```

{% endcode %}
{% endstep %}

{% step %}
**Generate a Public Key**

```sh
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

{% endstep %}

{% step %}
**Assign the public key to a Snowflake user**

```sql
ALTER USER TELESKOPE_USER SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';
```

{% hint style="info" %}
Exclude the public key delimiters in the SQL statement.
{% endhint %}
{% endstep %}

{% step %}
**Verify the user’s public key fingerprint**

1. Retrieve the User's Public Key Fingerprint **(In Snowflake)** and note the output:

```sql
DESC USER TELESKOPE_USER
  ->> SELECT SUBSTR(
        (SELECT "value" FROM $1
           WHERE "property" = 'RSA_PUBLIC_KEY_FP'),
        LEN('SHA256:') + 1) AS key;
```

2. Run the following command on **command line:**

{% code overflow="wrap" %}

```sh
openssl rsa -pubin -in rsa_key.pub -outform DER | openssl dgst -sha256 -binary | openssl enc -base64
```

{% endcode %}

3. Compare the outputs. If both outputs match, the user correctly configured their public key. Go back to the **Enrollment** step on the [previous page](/connectors/saas/snowflake.md) to complete enrollment.
   {% endstep %}
   {% endstepper %}
