> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Access Card Details

> Securely retrieve and decrypt a virtual card's PAN and CVC on the client using an encrypted session key.

The full card number (PAN) and CVC are encrypted and only accessible through a
secure retrieval flow. The last four digits and expiry date are always
available. This page explains how to retrieve and decrypt the full details on
the client so a cardholder can use a virtual card.

## How retrieval works

Retrieving full card details requires an encrypted `SessionId` header so only
the authorized cardholder can access the data. The flow has three steps:

<Steps>
  <Step title="Generate an encrypted session key">
    Generate a session key, then encrypt it with Rain's RSA public key using
    RSA-OAEP. The encrypted value is your `SessionId`.
  </Step>

  <Step title="Request the encrypted details">
    Call [Get a card's encrypted data](/reference/cards/get-a-cards-encrypted-data)
    with the encrypted `SessionId` in the request header.
  </Step>

  <Step title="Decrypt on the client">
    Decrypt the returned PAN and CVC with your session key using AES.
  </Step>
</Steps>

<Warning>
  **Security best practices:**

  * Never store decrypted card details.
  * Only request full card details when absolutely necessary.
  * Always use the latest encryption libraries to maintain security.
</Warning>

## Implementation guides

For complete code, follow the guide for your environment:

* [Manually implementing encryption and decryption](/docs/manually-implementing-encryption-and-decryption)
  for a browser client.
* [Use encryption outside a browser environment](/docs/using-encryption-outside-of-a-browser-environment)
  for server-side Node.js.

## What's next

<Columns cols={2}>
  <Card title="Test with simulations" icon="flask" href="/docs/simulating-transactions/overview">
    Simulate card transactions in the sandbox before you go live.
  </Card>

  <Card title="Manage transactions" icon="arrows-spin" href="/docs/transaction-lifecycle">
    Follow transactions from authorization through settlement once cards are
    live.
  </Card>
</Columns>
