chromium/crypto/scoped_nss_types.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CRYPTO_SCOPED_NSS_TYPES_H_
#define CRYPTO_SCOPED_NSS_TYPES_H_

#include <cert.h>
#include <certt.h>
#include <keyhi.h>
#include <nss.h>
#include <pk11pub.h>
#include <plarena.h>

#include <memory>

namespace crypto {

template <typename Type, void (*Destroyer)(Type*)>
struct NSSDestroyer {};

template <typename Type, void (*Destroyer)(Type*, PRBool), PRBool freeit>
struct NSSDestroyer1 {};

// Define some convenient scopers around NSS pointers.
ScopedPK11Context;
ScopedPK11Slot;
ScopedPK11SlotList;
ScopedSECKEYPublicKeyList;
ScopedPK11SymKey;
ScopedSECKEYPublicKey;
ScopedSECKEYPrivateKey;
ScopedSECAlgorithmID;
ScopedSECItem;
ScopedPLArenaPool;
ScopedCERTSubjectPublicKeyInfo;
ScopedCERTCertList;

}  // namespace crypto

#endif  // CRYPTO_SCOPED_NSS_TYPES_H_