Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6cryptokey.h
Go to the documentation of this file.
1 
13 #ifndef P6CRYPTOKEY_H__
14 #define P6CRYPTOKEY_H__ 1
15 
16 #include "p6random.h"
17 #include "p6crypto.h"
18 
19 namespace P6R {
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
35 const P6CRYPTOKEYFLAGS P6CKF_NONE = 0x00000000;
36 const P6CRYPTOKEYFLAGS P6CKF_FORCENEWIV = 0x00000001;
37 
49 typedef enum {
55 
56 
74 typedef enum {
82 
83 
89 interface p6ICryptoKeyInit : public p6ICom
90 {
104  P6COMMETHOD initialize( P6CRYPTOKEYFLAGS flags, p6IRandom* pRandom ) = 0;
105 
123  P6COMMETHOD loadKey( const P6WCHAR* pszFilename ) = 0;
124 
142  P6COMMETHOD loadKeyFromBuffer( const P6VOID* pBuffer, P6UINT32 cBuffer ) = 0;
143 
160  P6COMMETHOD loadRawSymetricKey( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
161 
179  P6COMMETHOD loadPKCS8Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
180 
198  P6COMMETHOD loadPublicPKCS1Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
199 
217  P6COMMETHOD loadPrivatePKCS1Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
218 
241  P6COMMETHOD loadRawPublicDSAKey( const P6UCHAR* pP, P6UINT32 pLength,
242  const P6UCHAR* pQ, P6UINT32 qLength,
243  const P6UCHAR* pG, P6UINT32 gLength,
244  const P6UCHAR* pY, P6UINT32 yLength ) = 0;
245 
268  P6COMMETHOD loadRawPrivateDSAKey( const P6UCHAR* pP, P6UINT32 pLength,
269  const P6UCHAR* pQ, P6UINT32 qLength,
270  const P6UCHAR* pG, P6UINT32 gLength,
271  const P6UCHAR* pX, P6UINT32 xLength ) = 0;
272 
291  P6COMMETHOD loadRawPublicRSAKey( const P6UCHAR* pE, P6UINT32 eLength, const P6UCHAR* pN, P6UINT32 nLength ) = 0;
292 
324  const P6R::P6UCHAR* pD, P6R::P6UINT32 dLength,
325  const P6R::P6UCHAR* pE, P6R::P6UINT32 eLength,
326  const P6R::P6UCHAR* pP, P6R::P6UINT32 pLength,
327  const P6R::P6UCHAR* pQ, P6R::P6UINT32 qLength,
328  const P6R::P6UCHAR* pPrimeExpP, P6R::P6UINT32 epLength,
329  const P6R::P6UCHAR* pPrimeExpQ, P6R::P6UINT32 eqLength,
330  const P6R::P6UCHAR* pCRT, P6R::P6UINT32 cLength ) = 0;
331 };
332 
333 // {7AAB1F32-075B-4B8D-B0E6-E4CE822882B7}
334 #define IF_p6ICryptoKeyInit {0x7AAB1F32,0x075B,0x4B8D,{0xB0,0xE6,0xE4,0xCE,0x82,0x28,0x82,0xB7}}
335 
336 
342 interface p6ICryptoKeyInit2 : public p6ICom
343 {
357  P6COMMETHOD initialize( P6CRYPTOKEYFLAGS flags, p6IRandom* pRandom ) = 0;
358 
376  P6COMMETHOD loadKey( const P6WCHAR* pszFilename ) = 0;
377 
395  P6COMMETHOD loadKeyFromBuffer( const P6VOID* pBuffer, P6UINT32 cBuffer ) = 0;
396 
413  P6COMMETHOD loadRawSymetricKey( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
414 
432  P6COMMETHOD loadPKCS8Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
433 
451  P6COMMETHOD loadPublicPKCS1Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
452 
470  P6COMMETHOD loadPrivatePKCS1Key( const P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32 keySize ) = 0;
471 
494  P6COMMETHOD loadRawPublicDSAKey( const P6UCHAR* pP, P6UINT32 pLength,
495  const P6UCHAR* pQ, P6UINT32 qLength,
496  const P6UCHAR* pG, P6UINT32 gLength,
497  const P6UCHAR* pY, P6UINT32 yLength ) = 0;
498 
521  P6COMMETHOD loadRawPrivateDSAKey( const P6UCHAR* pP, P6UINT32 pLength,
522  const P6UCHAR* pQ, P6UINT32 qLength,
523  const P6UCHAR* pG, P6UINT32 gLength,
524  const P6UCHAR* pX, P6UINT32 xLength ) = 0;
525 
544  P6COMMETHOD loadRawPublicRSAKey( const P6UCHAR* pE, P6UINT32 eLength, const P6UCHAR* pN, P6UINT32 nLength ) = 0;
545 
576  P6COMMETHOD loadRawPrivateRSAKey( const P6UCHAR* pN, P6UINT32 nLength,
577  const P6UCHAR* pD, P6UINT32 dLength,
578  const P6UCHAR* pE, P6UINT32 eLength,
579  const P6UCHAR* pP, P6UINT32 pLength,
580  const P6UCHAR* pQ, P6UINT32 qLength,
581  const P6UCHAR* pPrimeExpP, P6UINT32 epLength,
582  const P6UCHAR* pPrimeExpQ, P6UINT32 eqLength,
583  const P6UCHAR* pCRT, P6UINT32 cLength ) = 0;
584 
603  P6COMMETHOD loadRawPublicECKey( P6ECCURVE curveId, const P6UCHAR* pQ, P6UINT32 qLength ) = 0;
604 
623  P6COMMETHOD loadRawPrivateECKey( P6ECCURVE curveId, const P6UCHAR* pD, P6UINT32 dLength ) = 0;
624 
641 };
642 
643 // {D10AAB8D-5315-4e13-8644-09E27A1985B8}
644 #define IF_p6ICryptoKeyInit2 {0xd10aab8d,0x5315,0x4e13,{0x86,0x44,0x9,0xe2,0x7a,0x19,0x85,0xb8}}
645 
646 
669 typedef enum {
680 
681 
687 interface p6ICryptoKeyGetMeta : public p6ICom
688 {
706  P6COMMETHOD getDescriptiveLabel( P6WCHAR* pLabel, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
707 
725  P6COMMETHOD getUse( P6WCHAR* pUse, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
726 
739  P6COMMETHOD getState( P6CRYPTOKEYSTATE* pState ) = 0;
740 
758  P6COMMETHOD getStateAsString( P6WCHAR* pState, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
759 
772  P6COMMETHOD getCipher( P6CRYPTOCIPHER* pCipher ) = 0;
773 
791  P6COMMETHOD getCipherAsString( P6WCHAR* pCipher, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
792 
806  P6COMMETHOD getStateDate( P6CRYPTOKEYSTATE state, P6TIME* pDate ) = 0;
807 
820  P6COMMETHOD getExpiredDate( P6TIME* pExpire ) = 0;
821 
834  P6COMMETHOD getRenewalDate( P6TIME* pRenewal ) = 0;
835 
848  P6COMMETHOD getLastUpdated( P6TIME* pUpdated ) = 0;
849 
867  P6COMMETHOD getStateString( P6CRYPTOKEYSTATE state, P6WCHAR* pState, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
868 
886  P6COMMETHOD getCipherString( P6CRYPTOCIPHER cipher, P6WCHAR* pCipher, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
887 };
888 
889 // {8F3C646F-98B2-493d-8C10-0E71092064FF}
890 #define IF_p6ICryptoKeyGetMeta {0x8f3c646f,0x98b2,0x493d,{0x8c,0x10,0xe,0x71,0x9,0x20,0x64,0xff}}
891 
892 
898 interface p6ICryptoKeySetMeta : public p6ICom
899 {
913  P6COMMETHOD setDescriptiveLabel( const P6WCHAR* pLabel, P6UINT32 cBuffer ) = 0;
914 
928  P6COMMETHOD setUse( const P6WCHAR* pUse, P6UINT32 cBuffer ) = 0;
929 
941 
956  P6COMMETHOD setStateAsString( const P6WCHAR* pState ) = 0;
957 
968  P6COMMETHOD setCipher( P6CRYPTOCIPHER cipher ) = 0;
969 
984  P6COMMETHOD setCipherAsString( const P6WCHAR* pCipher ) = 0;
985 
997  P6COMMETHOD setStateDate( P6CRYPTOKEYSTATE state, P6TIME dateTime ) = 0;
998 
1011  P6COMMETHOD setExpiredDate( P6TIME expire ) = 0;
1012 
1024  P6COMMETHOD setRenewalDate( P6TIME renewal ) = 0;
1025 
1036  P6COMMETHOD setLastUpdated( P6TIME updated ) = 0;
1037 };
1038 
1039 // {CB3DCA8C-FA0E-41eb-8538-FC3A07D1A38A}
1040 #define IF_p6ICryptoKeySetMeta {0xcb3dca8c,0xfa0e,0x41eb,{0x85,0x38,0xfc,0x3a,0x7,0xd1,0xa3,0x8a}}
1041 
1042 
1043 
1062 static const P6CRYPTOKEYMASK P6CKM_NONE = 0x00000000;
1063 static const P6CRYPTOKEYMASK P6CKM_CLASS = 0x00000001;
1064 static const P6CRYPTOKEYMASK P6CKM_TYPE = 0x00000002;
1065 static const P6CRYPTOKEYMASK P6CKM_SIZE = 0x00000004;
1066 static const P6CRYPTOKEYMASK P6CKM_GUID = 0x00000008;
1067 static const P6CRYPTOKEYMASK P6CKM_VERSION = 0x00000010;
1068 
1085 typedef struct {
1086  P6CRYPTOKEYMASK mask;
1092 } P6CRYPTOKEYINFO;
1093 
1094 
1100 interface p6ICryptoKey : public p6ICom
1101 {
1120  P6COMMETHOD getInfo( P6CRYPTOKEYCLASS* pClass, P6CRYPTOKEYTYPE* pType, P6UUID* pGuid, P6INT32* pKeySize, P6INT32* pVersion ) = 0;
1121 
1162  P6COMMETHOD getDSAPublicKey( P6BSTR* pP, P6BSTR* pQ, P6BSTR* pG, P6BSTR* pY ) = 0;
1163 
1204  P6COMMETHOD getDSAPrivateKey( P6BSTR* pP, P6BSTR* pQ, P6BSTR* pG, P6BSTR* pX ) = 0;
1205 
1233  P6COMMETHOD getRSAPublicKey( P6BSTR* pN, P6BSTR* pE ) = 0;
1234 
1298  P6COMMETHOD getRSAPrivateKey( P6BSTR* pN, P6BSTR* pD, P6BSTR* pE, P6BSTR* pP, P6BSTR* pQ, P6BSTR* pPrimeExpP, P6BSTR* pPrimeExpQ, P6BSTR* pCRT ) = 0;
1299 
1318  P6COMMETHOD getKeyPKCS8( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32* pWritten ) = 0;
1319 
1338  P6COMMETHOD getKeyPKCS1( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32* pWritten ) = 0;
1339 
1357  P6COMMETHOD getSymetricKey( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
1358 
1376  P6COMMETHOD getSymetricIV( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
1377 
1396  P6COMMETHOD validateKey( P6CRYPTOKEYINFO* pKeyInfo ) = 0;
1397 
1409  P6COMMETHOD serializeToFile( const P6WCHAR* pFile ) = 0;
1410 
1430  P6COMMETHOD serializeToBuffer( P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32* pcBytesWritten ) = 0;
1431 
1444  P6COMMETHOD isEquals( p6ICryptoKey* pOtherKey, P6BOOL* pbEqual ) = 0;
1445 };
1446 
1447 // {A8E297EE-8F07-4D33-AD7F-CC642B52E765}
1448 #define IF_p6ICryptoKey {0xA8E297EE,0x8F07,0x4D33,{0xAD,0x7F,0xCC,0x64,0x2B,0x52,0xE7,0x65}}
1449 
1450 
1456 interface p6ICryptoKey2 : public p6ICom
1457 {
1476  P6COMMETHOD getInfo( P6CRYPTOKEYCLASS* pClass, P6CRYPTOKEYTYPE* pType, P6UUID* pGuid, P6INT32* pKeySize, P6INT32* pVersion ) = 0;
1477 
1518  P6COMMETHOD getDSAPublicKey( P6BSTR* pP, P6BSTR* pQ, P6BSTR* pG, P6BSTR* pY ) = 0;
1519 
1560  P6COMMETHOD getDSAPrivateKey( P6BSTR* pP, P6BSTR* pQ, P6BSTR* pG, P6BSTR* pX ) = 0;
1561 
1589  P6COMMETHOD getRSAPublicKey( P6BSTR* pN, P6BSTR* pE ) = 0;
1590 
1654  P6COMMETHOD getRSAPrivateKey( P6BSTR* pN, P6BSTR* pD, P6BSTR* pE, P6BSTR* pP, P6BSTR* pQ, P6BSTR* pPrimeExpP, P6BSTR* pPrimeExpQ, P6BSTR* pCRT ) = 0;
1655 
1674  P6COMMETHOD getKeyPKCS8( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32* pWritten ) = 0;
1675 
1694  P6COMMETHOD getKeyPKCS1( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32* pWritten ) = 0;
1695 
1713  P6COMMETHOD getSymetricKey( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
1714 
1732  P6COMMETHOD getSymetricIV( P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
1733 
1752  P6COMMETHOD validateKey( P6CRYPTOKEYINFO* pKeyInfo ) = 0;
1753 
1765  P6COMMETHOD serializeToFile( const P6WCHAR* pFile ) = 0;
1766 
1786  P6COMMETHOD serializeToBuffer( P6VOID* pBuffer, P6UINT32 cBuffer, P6UINT32* pcBytesWritten ) = 0;
1787 
1800  P6COMMETHOD isEquals( p6ICryptoKey* pOtherKey, P6BOOL* pbEqual ) = 0;
1801 
1825  P6COMMETHOD getECPublicKey( P6ECCURVE* pCurveId, P6BSTR* pQ ) = 0;
1826 
1850  P6COMMETHOD getECPrivateKey( P6ECCURVE* pCurveId, P6BSTR* pD ) = 0;
1851 
1871  P6COMMETHOD getECPrivateKeyASN1( P6BOOL bWithParams, P6BSTR* pASN1 ) = 0;
1872 };
1873 
1874 // {B3799EBF-8193-4bed-BCD3-73E7518B33E4}
1875 #define IF_p6ICryptoKey2 {0xb3799ebf,0x8193,0x4bed,{0xbc,0xd3,0x73,0xe7,0x51,0x8b,0x33,0xe4}}
1876 
1877 
1878 // {D797AD3A-1CD8-4A78-AF7E-3EE03B1AD897}
1879 #define COMP_p6CryptoKey {0xD797AD3A,0x1CD8,0x4A78,{0xAF,0x7E,0x3E,0xE0,0x3B,0x1A,0xD8,0x97}}
1880 
1881 #ifdef __cplusplus
1882 }
1883 #endif
1884 
1885 } // namespace
1886 
1887 #endif
1888 
virtual P6R::P6ERR loadRawSymetricKey(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the random bytes that comprise a symetric key into the component.
virtual P6R::P6ERR getState(P6CRYPTOKEYSTATE *pState)=0
This method retrieves the current state of the key (see reference 1).
virtual P6R::P6ERR loadPKCS8Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#8 encoded private key (either in PEM format or binary ASN.1 format).
const P6CRYPTOKEYFLAGS P6CKF_FORCENEWIV
Definition: p6cryptokey.h:36
virtual P6R::P6ERR getUse(P6WCHAR *pUse, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the human or machine readable description on how key is to be used (e...
virtual P6R::P6ERR loadPKCS8Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#8 encoded private key (either in PEM format or binary ASN.1 format).
virtual P6R::P6ERR initialize(P6CRYPTOKEYFLAGS flags, p6IRandom *pRandom)=0
Place the object in a state to load one or more crypto keys.
virtual P6R::P6ERR serializeToBuffer(P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 *pcBytesWritten)=0
Write the key in this component to the provided buffer.
virtual P6R::P6ERR setExpiredDate(P6TIME expire)=0
This method assigns the time that a key’s useful lifetime is terminated permanently.
virtual P6R::P6ERR loadRawPublicDSAKey(const P6UCHAR *pP, P6UINT32 pLength, const P6UCHAR *pQ, P6UINT32 qLength, const P6UCHAR *pG, P6UINT32 gLength, const P6UCHAR *pY, P6UINT32 yLength)=0
This method loads the standard parts of a DSA (DSS) public key from a set of buffers.
unsigned char P6UCHAR
Definition: p6types.h:74
virtual P6R::P6ERR loadKeyFromBuffer(const P6VOID *pBuffer, P6UINT32 cBuffer)=0
This function does the same operation as the loadKey() method except that the key data resides in a b...
virtual P6R::P6ERR getLastUpdated(P6TIME *pUpdated)=0
This method retrieves the time that the key (or its meta data) was last updated.
Cryptography component definitions.
This interface provides key metadata infrormation and key access.
Definition: p6cryptokey.h:1100
P6UINT32 P6CRYPTOKEYFLAGS
P6CRYPTOKEYFLAGS.
Definition: p6cryptokey.h:34
unsigned int P6UINT32
Definition: p6types.h:40
virtual P6R::P6ERR loadRawPublicDSAKey(const P6UCHAR *pP, P6UINT32 pLength, const P6UCHAR *pQ, P6UINT32 qLength, const P6UCHAR *pG, P6UINT32 gLength, const P6UCHAR *pY, P6UINT32 yLength)=0
This method loads the standard parts of a DSA (DSS) public key from a set of buffers.
virtual P6R::P6ERR setCipher(P6CRYPTOCIPHER cipher)=0
This method assignes the cipher algorthm to be used with the key (e.g., CIPHER_AES_CTR [counter mode]...
virtual P6R::P6ERR loadRawPublicRSAKey(const P6UCHAR *pE, P6UINT32 eLength, const P6UCHAR *pN, P6UINT32 nLength)=0
This method loads the standard parts of a RSA public key from a set of buffers.
virtual P6R::P6ERR validateKey(P6CRYPTOKEYINFO *pKeyInfo)=0
This method is used to validate the keys metadata against the provided parameter. ...
virtual P6R::P6ERR setRenewalDate(P6TIME renewal)=0
This method retrieves the time when the key life's time was extended.
virtual P6R::P6ERR getRSAPrivateKey(P6BSTR *pN, P6BSTR *pD, P6BSTR *pE, P6BSTR *pP, P6BSTR *pQ, P6BSTR *pPrimeExpP, P6BSTR *pPrimeExpQ, P6BSTR *pCRT)=0
This method retrieves the standard parts of a RSA private key.
Used to initialize and load a crypto key from a file or buffers.
Definition: p6cryptokey.h:89
virtual P6R::P6ERR getExpiredDate(P6TIME *pExpire)=0
This method retrieves the time that a key’s useful lifetime is terminated permanently.
virtual P6R::P6ERR getDSAPublicKey(P6BSTR *pP, P6BSTR *pQ, P6BSTR *pG, P6BSTR *pY)=0
This method retrieves the standard parts of a DSA (DSS) public key.
virtual P6R::P6ERR getKeyPKCS1(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32 *pWritten)=0
This method retrieves a RSA private or public key in the PKCS#1 format (unencrypted format)...
virtual P6R::P6ERR serializeToFile(const P6WCHAR *pFile)=0
Write the key in this component to the file defined in the parameter.
virtual P6R::P6ERR getKeyPKCS1(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32 *pWritten)=0
This method retrieves a RSA private or public key in the PKCS#1 format (unencrypted format)...
P6CRYPTOKEYCLASS
Used to categorize keys:
Definition: p6cryptokey.h:49
bool P6BOOL
Boolean type.
Definition: p6types.h:101
virtual P6R::P6ERR getInfo(P6CRYPTOKEYCLASS *pClass, P6CRYPTOKEYTYPE *pType, P6UUID *pGuid, P6INT32 *pKeySize, P6INT32 *pVersion)=0
This method returns the key's metadata.
virtual P6R::P6ERR getKeyPKCS8(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32 *pWritten)=0
This method retrieves a private key in the PKCS#8 format (unencrypted format).
virtual P6R::P6ERR getCipher(P6CRYPTOCIPHER *pCipher)=0
This method retrieves the cipher algorthm to be used with the key (e.g., CIPHER_AES_CTR [counter mode...
P6CRYPTOKEYTYPE
Used to categorize keys:
Definition: p6cryptokey.h:74
virtual P6R::P6ERR setUse(const P6WCHAR *pUse, P6UINT32 cBuffer)=0
This method assigns a value for the human or machine readable description on how key is to be used (e...
virtual P6R::P6ERR serializeToBuffer(P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 *pcBytesWritten)=0
Write the key in this component to the provided buffer.
virtual P6R::P6ERR isEquals(p6ICryptoKey *pOtherKey, P6BOOL *pbEqual)=0
Is the key in the 'pOtherKey' parameter the same as the key stored in this component.
virtual P6R::P6ERR getDescriptiveLabel(P6WCHAR *pLabel, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the "human readable set of descriptions for the key" (see reference 1)...
virtual P6R::P6ERR getSymetricIV(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the raw bits of a symetric initialization vector (IV).
virtual P6R::P6ERR getSymetricKey(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the raw bits of a symetric key (i.e., no metadata and not base64 encoded – see ...
virtual P6R::P6ERR loadRawPublicECKey(P6ECCURVE curveId, const P6UCHAR *pQ, P6UINT32 qLength)=0
This method loads the standard parts of an Eliptical Curve (EC) public key from a buffer...
virtual P6R::P6ERR getDSAPrivateKey(P6BSTR *pP, P6BSTR *pQ, P6BSTR *pG, P6BSTR *pX)=0
This method retrieves the standard parts of a DSA (DSS) private key.
virtual P6R::P6ERR getKeyPKCS8(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6BOOL wantPEM, P6UINT32 *pWritten)=0
This method retrieves a private key in the PKCS#8 format (unencrypted format).
Used to set extended key meta data as defined in reference 1 above.
Definition: p6cryptokey.h:898
virtual P6R::P6ERR setState(P6CRYPTOKEYSTATE state)=0
This method modifes the current state of the key (see reference 1).
virtual P6R::P6ERR initialize(P6CRYPTOKEYFLAGS flags, p6IRandom *pRandom)=0
Place the object in a state to load one or more crypto keys.
[p6]COM Cryptographic Random Number Generator.
virtual P6R::P6ERR loadPublicPKCS1Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#1 encoded public key (either in PEM format or binary ASN.1 format). ...
P6CRYPTOCIPHER
Cipher Type.
Definition: p6crypto.h:113
virtual P6R::P6ERR loadRawPrivateRSAKey(const P6UCHAR *pN, P6UINT32 nLength, const P6UCHAR *pD, P6UINT32 dLength, const P6UCHAR *pE, P6UINT32 eLength, const P6UCHAR *pP, P6UINT32 pLength, const P6UCHAR *pQ, P6UINT32 qLength, const P6UCHAR *pPrimeExpP, P6UINT32 epLength, const P6UCHAR *pPrimeExpQ, P6UINT32 eqLength, const P6UCHAR *pCRT, P6UINT32 cLength)=0
This method loads the standard parts of a RSA private key from a set of buffers.
This interface provides key metadata infrormation and key access.
Definition: p6cryptokey.h:1456
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
virtual P6R::P6ERR loadPrivatePKCS1Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#1 encoded private key (either in PEM format or binary ASN.1 format).
int P6INT32
Definition: p6types.h:41
P6CRYPTOKEYMASK mask
Definition: p6cryptokey.h:1086
virtual P6R::P6ERR getInfo(P6CRYPTOKEYCLASS *pClass, P6CRYPTOKEYTYPE *pType, P6UUID *pGuid, P6INT32 *pKeySize, P6INT32 *pVersion)=0
This method returns the key's metadata.
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
P6CRYPTOKEYTYPE keyType
Definition: p6cryptokey.h:1088
virtual P6R::P6ERR loadPrivatePKCS1Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#1 encoded private key (either in PEM format or binary ASN.1 format).
virtual P6R::P6ERR loadRawPrivateECKey(P6ECCURVE curveId, const P6UCHAR *pD, P6UINT32 dLength)=0
This method loads the standard parts of an Eliptical Curve (EC) private key from a buffer...
virtual P6R::P6ERR getStateAsString(P6WCHAR *pState, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the current state as a string.
virtual P6R::P6ERR getRSAPublicKey(P6BSTR *pN, P6BSTR *pE)=0
This method retrieves the standard parts of a RSA public key.
virtual P6R::P6ERR isEquals(p6ICryptoKey *pOtherKey, P6BOOL *pbEqual)=0
Is the key in the 'pOtherKey' parameter the same as the key stored in this component.
virtual P6R::P6ERR setCipherAsString(const P6WCHAR *pCipher)=0
This method allows the caller to set the cipher by providing a string value.
Provides a cryptographically strong random number generator.
Definition: p6random.h:70
Binary string.
Definition: p6types.h:153
virtual P6R::P6ERR validateKey(P6CRYPTOKEYINFO *pKeyInfo)=0
This method is used to validate the keys metadata against the provided parameter. ...
const P6CRYPTOKEYFLAGS P6CKF_NONE
Definition: p6cryptokey.h:35
P6CRYPTOKEYSTATE
The current state of the key as defined in: NIST DRAFT Special Publication 800-130, A Framework for Designing Cryptographic Key Management Systems, June 15, 2010.
Definition: p6cryptokey.h:669
P6ECCURVE
EC Curve Type.
Definition: p6crypto.h:175
A universally unique indentifier (UUID).
Definition: p6types.h:130
virtual P6R::P6ERR loadKeyFromBuffer(const P6VOID *pBuffer, P6UINT32 cBuffer)=0
This function does the same operation as the loadKey() method except that the key data resides in a b...
virtual P6R::P6ERR loadRawPrivateDSAKey(const P6UCHAR *pP, P6UINT32 pLength, const P6UCHAR *pQ, P6UINT32 qLength, const P6UCHAR *pG, P6UINT32 gLength, const P6UCHAR *pX, P6UINT32 xLength)=0
This method loads the standard parts of a DSA (DSS) private key from a set of buffers.
virtual P6R::P6ERR setStateDate(P6CRYPTOKEYSTATE state, P6TIME dateTime)=0
This method assigns the time that the key placed in a specific key state.
Used to initialize and load a crypto key from a file or buffers.
Definition: p6cryptokey.h:342
virtual P6R::P6ERR getDSAPrivateKey(P6BSTR *pP, P6BSTR *pQ, P6BSTR *pG, P6BSTR *pX)=0
This method retrieves the standard parts of a DSA (DSS) private key.
virtual P6R::P6ERR getCipherString(P6CRYPTOCIPHER cipher, P6WCHAR *pCipher, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
Return the string representation of the cipher input parameter.
virtual P6R::P6ERR getRenewalDate(P6TIME *pRenewal)=0
This method retrieves the time when the key life's time was extended (i.e., when the setExpiredDate()...
#define P6COMMETHOD
Definition: p6types.h:917
virtual P6R::P6ERR loadKey(const P6WCHAR *pszFilename)=0
This function reads the crypto key from the specified file.
P6INT64 P6TIME
The wallclock time represented as the number of microseconds since midnight January 1 1970 UTC...
Definition: p6types.h:227
virtual P6R::P6ERR serializeToFile(const P6WCHAR *pFile)=0
Write the key in this component to the file defined in the parameter.
virtual P6R::P6ERR getRSAPrivateKey(P6BSTR *pN, P6BSTR *pD, P6BSTR *pE, P6BSTR *pP, P6BSTR *pQ, P6BSTR *pPrimeExpP, P6BSTR *pPrimeExpQ, P6BSTR *pCRT)=0
This method retrieves the standard parts of a RSA private key.
virtual P6R::P6ERR loadRawPrivateDSAKey(const P6UCHAR *pP, P6UINT32 pLength, const P6UCHAR *pQ, P6UINT32 qLength, const P6UCHAR *pG, P6UINT32 gLength, const P6UCHAR *pX, P6UINT32 xLength)=0
This method loads the standard parts of a DSA (DSS) private key from a set of buffers.
P6CRYPTOKEYCLASS keyClass
Definition: p6cryptokey.h:1087
virtual P6R::P6ERR loadRawSymetricKey(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the random bytes that comprise a symetric key into the component.
virtual P6R::P6ERR getECPrivateKeyASN1(P6BOOL bWithParams, P6BSTR *pASN1)=0
This method retrieves the Eliptical Curve (EC) private key along with its parameters (i...
virtual P6R::P6ERR loadKey(const P6WCHAR *pszFilename)=0
This function reads the crypto key from the specified file.
virtual P6R::P6ERR loadRawPublicRSAKey(const P6UCHAR *pE, P6UINT32 eLength, const P6UCHAR *pN, P6UINT32 nLength)=0
This method loads the standard parts of a RSA public key from a set of buffers.
virtual P6R::P6ERR setStateAsString(const P6WCHAR *pState)=0
This method allows the caller to set the state by providing a string value.
P6UINT32 P6CRYPTOKEYMASK
P6CRYPTOKEYMASK.
Definition: p6cryptokey.h:1061
virtual P6R::P6ERR getDSAPublicKey(P6BSTR *pP, P6BSTR *pQ, P6BSTR *pG, P6BSTR *pY)=0
This method retrieves the standard parts of a DSA (DSS) public key.
Used to obtain extended key meta data as defined in reference 1 above.
Definition: p6cryptokey.h:687
virtual P6R::P6ERR getSymetricKey(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the raw bits of a symetric key (i.e., no metadata and not base64 encoded – see ...
virtual P6R::P6ERR loadASN1PrivateECKey(P6BSTR *pASN1)=0
This method loads the standard parts of an Eliptical Curve (EC) private key from a buffer containing ...
virtual P6R::P6ERR getSymetricIV(P6UCHAR *pBuffer, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the raw bits of a symetric initialization vector (IV).
void P6VOID
Definition: p6types.h:75
virtual P6R::P6ERR getCipherAsString(P6WCHAR *pCipher, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
This method retrieves the current algorith to be used with the key as a string.
When a key is written to a file it is stamped with a set of meta data that define the key...
Definition: p6cryptokey.h:1085
virtual P6R::P6ERR setLastUpdated(P6TIME updated)=0
This method assigns the time that the key (or its meta data) was last updated.
virtual P6R::P6ERR loadRawPrivateRSAKey(const P6R::P6UCHAR *pN, P6R::P6UINT32 nLength, const P6R::P6UCHAR *pD, P6R::P6UINT32 dLength, const P6R::P6UCHAR *pE, P6R::P6UINT32 eLength, const P6R::P6UCHAR *pP, P6R::P6UINT32 pLength, const P6R::P6UCHAR *pQ, P6R::P6UINT32 qLength, const P6R::P6UCHAR *pPrimeExpP, P6R::P6UINT32 epLength, const P6R::P6UCHAR *pPrimeExpQ, P6R::P6UINT32 eqLength, const P6R::P6UCHAR *pCRT, P6R::P6UINT32 cLength)=0
This method loads the standard parts of a RSA private key from a set of buffers.
virtual P6R::P6ERR getECPublicKey(P6ECCURVE *pCurveId, P6BSTR *pQ)=0
This method retrieves the standard parts of an Eliptical Curve (EC) public key (this function only ha...
virtual P6R::P6ERR loadPublicPKCS1Key(const P6VOID *pBuffer, P6UINT32 cBuffer, P6UINT32 keySize)=0
Load the PKCS#1 encoded public key (either in PEM format or binary ASN.1 format). ...
virtual P6R::P6ERR setDescriptiveLabel(const P6WCHAR *pLabel, P6UINT32 cBuffer)=0
This method assigns a value for the "human readable set of descriptions for the key" (see reference 1...
virtual P6R::P6ERR getStateDate(P6CRYPTOKEYSTATE state, P6TIME *pDate)=0
This method retrieves the time that the key was placed in a specific key state.
virtual P6R::P6ERR getECPrivateKey(P6ECCURVE *pCurveId, P6BSTR *pD)=0
This method retrieves the standard parts of an Eliptical Curve (EC) private key (this function only h...
virtual P6R::P6ERR getRSAPublicKey(P6BSTR *pN, P6BSTR *pE)=0
This method retrieves the standard parts of a RSA public key.
virtual P6R::P6ERR getStateString(P6CRYPTOKEYSTATE state, P6WCHAR *pState, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
Return the string representation of a key state value passed in as an input parameter.