.net core client to RIPE Database and hosted RPKI
$ dotnet add package RipeClient.NET Core RIPE Database client
dotnet add package RipeClient
var ripe = new RipeClient(new RipeSecureLocation(),
new RipeClientAuthAnonymous());
var result = await ripe.Search(new RipeSearchRequest(request.Prefix, TypeFilter.Inetnum));
The RIPE Database supports multiple authentication methods. Choose the appropriate method based on your use case.
Use anonymous authentication for public read-only operations such as searching the database.
var auth = new RipeClientAuthAnonymous();
var client = new RipeClient(new RipeSecureLocation(), auth);
// Search for objects
var results = await client.Search(
new RipeSearchRequest("192.0.2.0/24", TypeFilter.Inetnum)
);
Traditional authentication method using password query parameter. The password is sent as a query string parameter (?password=xxx).
var auth = new RipeClientAuthPassword("your-password");
var client = new RipeClient(new RipeSecureLocation(), auth);
// Create a new person object
var person = new Person();
person["person"] = "John Doe";
person["address"] = "123 Main St";
person["phone"] = "+1-234-567-8900";
person["nic-hdl"] = "AUTO-1";
person["mnt-by"] = "YOUR-MNT";
person["source"] = "RIPE";
await client.AddObject(person);
Modern authentication method using the X-API-Key HTTP header. This is the recommended method for automated systems and applications.
How to get an API key:
var auth = new RipeClientAuthApiKey("your-api-key-here");
var client = new RipeClient(new RipeSecureLocation(), auth);
// Update an existing object
var route = await client.GetObjectByKey("192.0.2.0/24", "route", "ripe");
route["descr"] = "Updated description";
await client.UpdateObject(route);
Advantages of API Key authentication:
HTTP Basic Authentication sends credentials as a Base64-encoded username:password in the Authorization header.
var auth = new RipeClientAuthBasic("username", "password");
var client = new RipeClient(new RipeSecureLocation(), auth);
// Delete an object
var objectToDelete = await client.GetObjectByKey("PP1-RIPE", "person", "ripe");
await client.RemoveObject(objectToDelete);
var auth = new RipeClientAuthAnonymous();
var client = new RipeClient(new RipeSecureLocation(), auth);
// Search for both IPv4 and IPv6 routes
var request = new RipeSearchRequest("AS64512");
request.AddFilter(TypeFilter.Route | TypeFilter.Route6);
var results = await client.Search(request);
// Find one level more specific
var request = new RipeSearchRequest("192.0.2.0/24", TypeFilter.Inetnum);
request.AddFlag(RipeSearchRequestFlags.OneMore);
var results = await client.Search(request);
Enable HTTP request/response debugging to troubleshoot API calls:
var client = new RipeClient(new RipeSecureLocation(), auth);
client.Debug = true; // Logs all HTTP traffic to console
var results = await client.Search(request);
| Method | Use Case | Security | Sent Via |
|---|---|---|---|
| Anonymous | Public searches | N/A | None |
| Password | Legacy systems, manual operations | Low | Query parameter |
| API Key | Automated systems, applications | High | HTTP Header (X-API-Key) |
| Basic Auth | Systems requiring standard auth | Medium | HTTP Header (Authorization) |
Recommendation: Use API Key authentication for production applications and automated systems. Use Anonymous for read-only operations.
For more information about RIPE Database API: