---
name: "sc_base64_encode"
section: "3"
platform: "linux"
package: "libopensc2-dev"
version: "0.11.13-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_base64_encode"
---

# sc\_base64\_encode(3)

Encode a stream to base64

## NAME

sc\_base64\_encode - Encode a stream to base64

## SYNOPSIS

```
#include <opensc.h>
int sc_base64_encode(const unsigned char *inbuf, size_t inlen,
                     unsigned char *outbuf, size_t outlen,
                     size_t linelength);
```

## DESCRIPTION

This function encodes the buffer pointed to by *inbuf* of size *inlen* as base64, and stores the result in *outbuf*, which is *outlen* bytes long. A linefeed (\\n) will be inserted every *linelength* bytes in the output buffer.

You must ensure *outbuf* has enough space to store the base64-encoded version of *inbuf*.

## RETURN VALUE

Returns 0 if successful, or a negative value in case of error.
