PKIFCryptoPPUtils.cpp File Reference


Detailed Description

Subsystem: Cryptography (PKIFCRYPTO)

Module: PKIFCryptoPPUtils

Id
PKIFCryptoPPUtils.cpp 10735 2009-10-19 19:40:30Z cwallace

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>

Include dependency graph for PKIFCryptoPPUtils.cpp:

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)


Function Documentation

CPKIFCredentialPtr _MakeCredentialFromP8File ( const std::string &  file  ) 

Interface: Module

This function creates a CPKIFCredential object from a file containign PKCS8 object

Returns:
A smart pointer to CPKIFCredential obejct
Parameters:
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

Returns:
a buffer containing a secret key
Parameters:
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.

Returns:
CPKIFBuffer object

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

Returns:
Buffer containing der-encoded tbsCertificate sequence
Parameters:
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.

Returns:
PKIFCryptoPPCredential object
Exceptions:
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.

Returns:
PKIFCryptoPPCredential object
Exceptions:
CPKIFException(COMMON_INVALID_INPUT) 
Parameters:
file  [in] string containg the location of the PKCS 8 file

Definition at line 206 of file PKIFCryptoPPUtils.cpp.

References _MakeCredentialFromP8File().


Generated on Mon Nov 15 11:18:18 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6