---
name: "ldns_key_new"
section: "3"
platform: "linux"
package: "ldns"
version: "1.9.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ldns_key_new"
---

# ldns\_key\_new(3)

create a ldns\_key

## NAME

ldns\_key\_new, ldns\_key\_new\_frm\_algorithm, ldns\_key\_new\_frm\_fp, ldns\_key\_new\_frm\_fp\_l, ldns\_key\_new\_frm\_fp\_rsa, ldns\_key\_new\_frm\_fp\_rsa\_l, ldns\_key\_new\_frm\_fp\_dsa, ldns\_key\_new\_frm\_fp\_dsa\_l - create a ldns\_key

## SYNOPSIS

\#include \<stdint.h\>\
 \#include \<stdbool.h\>\

\#include \<ldns/ldns.h\>

ldns\_key\* ldns\_key\_new(void);

ldns\_key\* ldns\_key\_new\_frm\_algorithm(ldns\_signing\_algorithm a, uint16\_t size);

ldns\_status ldns\_key\_new\_frm\_fp(ldns\_key \*\*k, FILE \*fp);

ldns\_status ldns\_key\_new\_frm\_fp\_l(ldns\_key \*\*k, FILE \*fp, int \*line\_nr);

RSA\* ldns\_key\_new\_frm\_fp\_rsa(FILE \*fp);

RSA\* ldns\_key\_new\_frm\_fp\_rsa\_l(FILE \*fp, int \*line\_nr);

DSA\* ldns\_key\_new\_frm\_fp\_dsa(FILE \*fp);

DSA\* ldns\_key\_new\_frm\_fp\_dsa\_l(FILE \*fp, int \*line\_nr);

## DESCRIPTION

*ldns\_key\_new*() Creates a new empty key structure .br Returns a new ldns\_key \* structure

*ldns\_key\_new\_frm\_algorithm*() Creates a new key based on the algorithm

.br **a**: The algorithm to use .br **size**: the number of bytes for the keysize .br Returns a new ldns\_key structure with the key

*ldns\_key\_new\_frm\_fp*() Creates a new priv key based on the  contents of the file pointed by fp.

The file should be in Private-key-format v1.x.

.br **k**: the new ldns\_key structure .br **fp**: the file pointer to use .br Returns an error or LDNS\_STATUS\_OK

*ldns\_key\_new\_frm\_fp\_l*() Creates a new private key based on the  contents of the file pointed by fp

The file should be in Private-key-format v1.x.

.br **k**: the new ldns\_key structure .br **fp**: the file pointer to use .br **line\_nr**: pointer to an integer containing the current line number (for debugging purposes) .br Returns an error or LDNS\_STATUS\_OK

*ldns\_key\_new\_frm\_fp\_rsa*() frm\_fp helper function. This function parses the remainder of the (RSA) priv. key file generated from bind9 .br **fp**: the file to parse .br Returns NULL on failure otherwise a RSA structure

*ldns\_key\_new\_frm\_fp\_rsa\_l*() frm\_fp helper function. This function parses the remainder of the (RSA) priv. key file generated from bind9 .br **fp**: the file to parse .br **line\_nr**: pointer to an integer containing the current line number (for debugging purposes) .br Returns NULL on failure otherwise a RSA structure

*ldns\_key\_new\_frm\_fp\_dsa*() frm\_fp helper function. This function parses the remainder of the (DSA) priv. key file .br **fp**: the file to parse .br Returns NULL on failure otherwise a RSA structure

*ldns\_key\_new\_frm\_fp\_dsa\_l*() frm\_fp helper function. This function parses the remainder of the (DSA) priv. key file .br **fp**: the file to parse .br **line\_nr**: pointer to an integer containing the current line number (for debugging purposes) .br Returns NULL on failure otherwise a RSA structure

## AUTHOR

The ldns team at NLnet Labs.

## REPORTING BUGS

Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues

## COPYRIGHT

Copyright (c) 2004 - 2006 NLnet Labs.

Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO

*ldns\_key*. And **perldoc Net::DNS**, **RFC1034**, **RFC1035**, **RFC4033**, **RFC4034**  and **RFC4035**.

## REMARKS

This manpage was automatically generated from the ldns source code.
