This file is indexed.

/usr/include/Poco/Crypto/PKCS12Container.h is in libpoco-dev 1.8.0.1-1ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//
// PKCS12Container.h
//
// Library: Crypto
// Package: Certificate
// Module:  PKCS12Container
//
// Definition of the PKCS12Container class.
//
// Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#ifndef Crypto_PKCS12Container_INCLUDED
#define Crypto_PKCS12Container_INCLUDED


#include "Poco/Crypto/Crypto.h"
#include "Poco/Crypto/OpenSSLInitializer.h"
#include "Poco/Crypto/X509Certificate.h"
#include "Poco/Crypto/EVPPKey.h"
#include "Poco/Path.h"
#include <memory>
#include <istream>
#include <openssl/pkcs12.h>


namespace Poco {
namespace Crypto {


class Crypto_API PKCS12Container
	/// This class implements PKCS#12 container functionality.
{
public:
	typedef X509Certificate::List CAList;
	typedef std::vector<std::string> CANameList;

	explicit PKCS12Container(std::istream& istr, const std::string& password = "");
		/// Creates the PKCS12Container object from a stream.

	explicit PKCS12Container(const std::string& path, const std::string& password = "");
		/// Creates the PKCS12Container object from a file.

	PKCS12Container(const PKCS12Container& cont);
		/// Copy constructor.

	PKCS12Container& operator = (const PKCS12Container& cont);
		/// Assignment operator.

#ifdef POCO_ENABLE_CPP11

	PKCS12Container(PKCS12Container&& cont);
		/// Move constructor.

	PKCS12Container& operator = (PKCS12Container&& cont);
		/// Move assignment operator.

#endif // POCO_ENABLE_CPP11

	~PKCS12Container();
		/// Destroys the PKCS12Container.

	bool hasKey() const;
		/// Returns true if container contains the key.

	EVPPKey getKey() const;
		/// Return key as openssl EVP_PKEY wrapper object.

	bool hasX509Certificate() const;
		/// Returns true if container has X509 certificate.

	const X509Certificate& getX509Certificate() const;
		/// Returns the X509 certificate.
		/// Throws NotFoundException if there is no certificate.

	const CAList& getCACerts() const;
		/// Returns the list of CA certificates in this container.

	const std::string& getFriendlyName() const;
		/// Returns the friendly name of the certificate bag.

	const CANameList& getFriendlyNamesCA() const;
		/// Returns a list of CA certificates friendly names.

private:
	void load(PKCS12* pPKCS12, const std::string& password = "");
	std::string extractFriendlyName(X509* pCert);

#ifdef POCO_ENABLE_CPP11
	typedef std::unique_ptr<X509Certificate> CertPtr;
#else
	typedef std::auto_ptr<X509Certificate> CertPtr;
#endif // #ifdef POCO_ENABLE_CPP11

	OpenSSLInitializer _openSSLInitializer;
	EVP_PKEY*          _pKey;
	CertPtr            _pX509Cert;
	CAList             _caCertList;
	CANameList         _caCertNames;
	std::string        _pkcsFriendlyName;
};


//
// inlines
//

inline bool PKCS12Container::hasX509Certificate() const
{
	return _pX509Cert.get() != 0;
}


inline const X509Certificate& PKCS12Container::getX509Certificate() const
{
	if (!hasX509Certificate())
		throw NotFoundException("PKCS12Container X509 certificate");
	return *_pX509Cert;
}


inline const std::string& PKCS12Container::getFriendlyName() const
{
	return _pkcsFriendlyName;
}


inline const PKCS12Container::CAList& PKCS12Container::getCACerts() const
{
	return _caCertList;
}


inline const PKCS12Container::CANameList& PKCS12Container::getFriendlyNamesCA() const
{
	return _caCertNames;
}


inline bool PKCS12Container::hasKey() const
{
	return _pKey != 0;
}


inline EVPPKey PKCS12Container::getKey() const
{
	return EVPPKey(_pKey);
}


} } // namespace Poco::Crypto


#endif // Crypto_PKCS12Container_INCLUDED