Example #1
0
char * rpmPubkeyBase64(rpmPubkey key)
{
    char *enc = NULL;

    if (key) {
	enc = rpmBase64Encode(key->pkt, key->pktlen, -1);
    }
    return enc;
}
Example #2
0
/**
 * Encode binary data in base64 for display.
 * @todo Permit selectable display formats (i.e. binary).
 * @param td		tag data container
 * @return		formatted string
 */
static char * base64Format(rpmtd td)
{
    char * val = NULL;

    if (rpmtdType(td) != RPM_BIN_TYPE) {
	val = xstrdup(_("(not a blob)"));
    } else {
	val = rpmBase64Encode(td->data, td->count, -1);
	if (val == NULL)
	    val = xstrdup("");
    }

    return val;
}
Example #3
0
File: rpmlua.c Project: Tojaj/rpm
static int rpm_b64encode(lua_State *L)
{
    const char *str = luaL_checkstring(L, 1);
    size_t len = lua_strlen(L, 1);
    int linelen = -1;
    if (lua_gettop(L) == 2)
	linelen = luaL_checkinteger(L, 2);
    if (str && len) {
	char *data = rpmBase64Encode(str, len, linelen);
	lua_pushstring(L, data);
	free(data);
    }
    return 1;
}