Module: PKIFCryptoPPUtils
Definition in file PKIFCryptoPPUtils.cpp.
#include "PKIFCryptoPPUtils.h"
#include "PKIFCryptoPPKeyMaterial.h"
#include "PKIFCryptoPPCredential.h"
#include "FileUtils.h"
#include "PKIFBase64.h"
#include "Buffer.h"
#include "OID.h"
#include "PKIFMemoryUtils.h"
#include "PKIFCredential.h"
#include "PKIFKeyMaterial.h"
#include "SubjectPublicKeyInfo.h"
#include "Certificate.h"
#include "ASN1Helper.h"
#include "PKIX1Explicit88.h"
#include "ECC-CMS.h"
#include "PKIFAlgorithm.h"
#include <netinet/in.h>
#include "boost/filesystem/path.hpp"
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/fstream.hpp"
#include "boost/scoped_ptr.hpp"
#include <iostream>
#include <sstream>
#include "boost/numeric/conversion/cast.hpp"
#include "boost/numeric/conversion/bounds.hpp"
#include "boost/limits.hpp"
#include "cryptlib.h"
#include "queue.h"
#include "asn.h"
#include "sha.h"
#include <strstream>
Go to the source code of this file.
Functions | |
CPKIFBufferPtr | GetTBSCertSequence (const CPKIFCertificate &cert) |
CPKIFCredentialPtr | _MakeCredentialFromP8File (const std::string &file) |
CPKIFCredentialPtr | MakeCredentialFromP8File (const std::string &file) |
CPKIFCredentialPtr | MakeCredentialFromP8File (const std::string &file, const std::string &certFile) |
CPKIFBufferPtr | GetEncodedSPKIFromKM (const CPKIFKeyMaterial &km) |
CPKIFBufferPtr | DeriveKeyFromSecret (const CPKIFBufferPtr &secret, const CPKIFBufferPtr &sharedInfo, unsigned int keyLength) |
CPKIFCredentialPtr _MakeCredentialFromP8File | ( | const std::string & | file | ) |
Interface: Module
This function creates a CPKIFCredential object from a file containign PKCS8 object
file | [in] String containing the location of PKCS8 file |
Definition at line 112 of file PKIFCryptoPPUtils.cpp.
References COMMON_INVALID_INPUT, CPKIFAlgorithm::GetAlg(), PEMDecode_l(), PKIFZero(), ReadFileIntoBuffer(), and TOOLKIT_CRYPTO.
Referenced by MakeCredentialFromP8File().
CPKIFBufferPtr DeriveKeyFromSecret | ( | const CPKIFBufferPtr & | secret, | |
const CPKIFBufferPtr & | sharedInfo, | |||
unsigned int | keyLength | |||
) |
Interface: External
Derives a symmetric key from secret and non-secret data.
If length is 0, sharedInfo must be a DER-encoded ECC CMS Shared Info buffer
secret | [in] shared secret from a key agreement operation |
sharedInfo | [in] shared info to append to the hashed data |
keyLength | [in] length of the key to derive. If keyLength is 0, sharedInfo must be an ECC CMS SharedInfo structure |
Definition at line 283 of file PKIFCryptoPPUtils.cpp.
References CACASNWRAPPER_CREATE, COMMON_INVALID_INPUT, PKIFCRYPTO::SHA256, PKIFCRYPTO::SHA384, and TOOLKIT_CRYPTO.
CPKIFBufferPtr GetEncodedSPKIFromKM | ( | const CPKIFKeyMaterial & | km | ) |
Interface: External
Returns an encoded SubjectPublicKeyInfo structure from a Key Material object if possible.
Definition at line 267 of file PKIFCryptoPPUtils.cpp.
CPKIFBufferPtr GetTBSCertSequence | ( | const CPKIFCertificate & | cert | ) |
Interface: External
Pulls the der-encoded tbsCertificate out of a certificate object for easy signature verification
cert | [in] PKIF certificate object from which the encoded sequence will be taken |
Definition at line 76 of file PKIFCryptoPPUtils.cpp.
References COMMON_INVALID_INPUT, CPKIFCertificate::Encoded(), and TOOLKIT_CRYPTO.
Referenced by CPKIFCryptoPPRaw::VerifyCertificate(), and VerifyCertificateWithCryptoPP().
CPKIFCredentialPtr MakeCredentialFromP8File | ( | const std::string & | file, | |
const std::string & | certFile | |||
) |
Interface: External
Creates a Crypto++ Credential given a file. Handle with care, the file and the credential will contain plaintext key material. This will throw if it can't read the file and return an empty credential if the file is readable but invalid.
CPKIFException(COMMON_INVALID_INPUT) |
Definition at line 223 of file PKIFCryptoPPUtils.cpp.
References _MakeCredentialFromP8File(), PEMDecode_l(), and ReadFileIntoBuffer().
CPKIFCredentialPtr MakeCredentialFromP8File | ( | const std::string & | file | ) |
Interface: External
Creates a Crypto++ Credential given a file. Handle with care, the file and the credential will contain plaintext key material. This will throw if it can't read the file and return an empty credential if the file is readable but invalid.
CPKIFException(COMMON_INVALID_INPUT) |
file | [in] string containg the location of the PKCS 8 file |
Definition at line 206 of file PKIFCryptoPPUtils.cpp.
References _MakeCredentialFromP8File().