]> git.proxmox.com Git - ceph.git/blame - ceph/src/auth/RotatingKeyRing.h
update sources to v12.1.1
[ceph.git] / ceph / src / auth / RotatingKeyRing.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15#ifndef CEPH_ROTATINGKEYRING_H
16#define CEPH_ROTATINGKEYRING_H
17
18#include "common/Mutex.h"
19#include "auth/Auth.h"
20
21/*
22 * mediate access to a service's keyring and rotating secrets
23 */
24
25class KeyRing;
26class CephContext;
27
28class RotatingKeyRing : public KeyStore {
29 CephContext *cct;
30 uint32_t service_id;
31 RotatingSecrets secrets;
32 KeyRing *keyring;
33 mutable Mutex lock;
34
35public:
36 RotatingKeyRing(CephContext *cct_, uint32_t s, KeyRing *kr) :
37 cct(cct_),
38 service_id(s),
39 keyring(kr),
40 lock("RotatingKeyRing::lock") {}
41
42 bool need_new_secrets() const;
43 bool need_new_secrets(utime_t now) const;
224ce89b 44 void set_secrets(RotatingSecrets&& s);
7c673cae
FG
45 void dump_rotating() const;
46 bool get_secret(const EntityName& name, CryptoKey& secret) const override;
47 bool get_service_secret(uint32_t service_id, uint64_t secret_id,
48 CryptoKey& secret) const override;
49 KeyRing *get_keyring();
50};
51
52#endif