📄 pgplicensenumber.h
字号:
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: pgpLicenseNumber.h,v 1.10 2002/11/14 23:22:33 jeffc Exp $
____________________________________________________________________________*/
#ifndef Included_pgpLicenseAuthorization_h /* [ */
#define Included_pgpLicenseAuthorization_h
#include "pgpMemoryMgr.h"
#include "pgpPubTypes.h"
typedef void *PGPLicenseNumberRef;
#define kInvalidPGPLicenseNumberRef ((PGPLicenseNumberRef) NULL)
#define PGPLicenseNumberRefIsValid(ref) ((ref) != kInvalidPGPLicenseNumberRef)
typedef void *PGPLicenseAuthorizationRef;
#define kInvalidPGPLicenseAuthorizationRef ((PGPLicenseAuthorizationRef) NULL)
#define PGPLicenseAuthorizationRefIsValid(ref) ((ref) != kInvalidPGPLicenseAuthorizationRef)
#define kPGPLicenseNumberFlag_Evaluation 1
#define kPGPLicenseNumberFlag_Enterprise 2
#define kPGPLicenseNumberFlag_Disk 4
#define kPGPLicenseNumberFlag_Mail 8
#define kPGPLicenseNumberFlag_Desktop 16
#define kPGPLicenseNumberVersion 1
#define kPGPLicenseNumberMaxSize 80
/* maximum size for the buffer used for the license number,
including encoded license number */
#define kPGPLicenseNumberDashedTemplate "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxx"
PGP_BEGIN_C_DECLARATIONS
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
PGPError pgpLNExportUrlEncoded(PGPContextRef context,
const PGPLicenseNumberRef ln_ref, PGPByte urlEncoded[kPGPLicenseNumberMaxSize]);
// Creates a proof number based on entry fields (using hardcoded private key).
// For use by web tools.
PGPError PGPLNCreate(PGPContextRef context,
PGPUInt8 productID,
PGPUInt16 evalPeriod,
PGPUInt32 numLicenses, // 24 bit
PGPUInt8 flags,
PGPUInt32 serialNumber,
PGPLicenseNumberRef *buffer);
// Takes a base32 proof number and imports it into internal opaque structure
PGPError PGPLNImportBase32(PGPContextRef context,
const PGPByte *licenseNumber32,
PGPLicenseNumberRef *buffer);
// Exports internal opaque structure to base32
PGPError PGPLNExportBase32(PGPContextRef context,
const PGPLicenseNumberRef licenseNumber,
const PGPByte *templ, /* for instance, kPGPLicenseNumberDashedTemplate;
NULL for most compact form */
PGPByte base32[kPGPLicenseNumberMaxSize]);
// Functions for retrieving internal values
PGPError PGPLNGetProductID(PGPContextRef context,PGPLicenseNumberRef licenseNumber,
PGPUInt8 *productID);
PGPError PGPLNGetEvalPeriod(PGPContextRef context,PGPLicenseNumberRef licenseNumber,
PGPUInt16 *evalPeriod);
PGPError PGPLNGetNumLicenses(PGPContextRef context,PGPLicenseNumberRef licenseNumber,
PGPUInt32 *numlicenses); // 24 bit
PGPError PGPLNGetFlags(PGPContextRef context,PGPLicenseNumberRef licenseNumber,
PGPUInt8 *flags);
PGPError PGPLNGetSN(PGPContextRef context,PGPLicenseNumberRef licenseNumber,
PGPUInt32 *serialNumber);
// Free internal opaque structure
void PGPLNFree(PGPLicenseNumberRef licenseNumber);
// Creates license number based on proof number and entry fields (using
// hard coded private key). For use by web tools
PGPError PGPLACreate(PGPContextRef context,
const PGPByte *url,
// NULL for local creationm when provate signing key is available
const PGPLicenseNumberRef licenseNumber,
const PGPByte *customerName,
const PGPByte *companyName,
PGPLicenseAuthorizationRef *buffer );
/* Imports base64 enclosed in BEGIN...END LA into internal structure */
PGPError PGPLAImportBlocked(PGPContextRef context,
const PGPByte *licenseAuthorizationBlocked,
PGPLicenseAuthorizationRef *buffer);
// Exports internal opaque structure into base64 enclosed in BEGIN...END
PGPError PGPLAExportBlocked(PGPContextRef context,
PGPLicenseAuthorizationRef licenseAuthorization,
PGPByte **blocked);
/* exports LA to base64 format without BEGIN...END block */
PGPError PGPLAExportBase64( PGPContextRef context,
const PGPLicenseAuthorizationRef licenseAuthorization,
PGPByte **b64 );
/* imports LA from base64 format without BEGIN...END block */
PGPError PGPLAImportBase64( PGPContextRef context,
const PGPByte *b64,
PGPLicenseAuthorizationRef *licenseAuthorization );
// Free internal opaque structure
void PGPLAFree(PGPLicenseAuthorizationRef licenseAuthorization);
// Compares imported proof and license number and determines if valid. Error if not.
PGPError PGPLAVerify(PGPContextRef context,
PGPLicenseNumberRef licenseNumber,
PGPLicenseAuthorizationRef licenseAuthorization,
const PGPByte *customerName,
const PGPByte *companyName);
// Gives number of days left in LA
PGPError PGPLADaysLeft(PGPContextRef context, PGPLicenseNumberRef ln_ref,
PGPLicenseAuthorizationRef la_ref, PGPInt32 *daysLeft);
/* Returns hash of customerName and companyName in the form of null-terminated string in base64 encoding.
* Application that needs to compare two pairs of (companyName,customerName) must compare these hashes.
* For the purpose of LA it is insufficient to compare customer/company name by other methods, such as strcmp,
* to determine that the strings are the same
*/
PGPError PGPLAGetNameHash(PGPContextRef context, const PGPByte *customerName,
const PGPByte *companyName, PGPByte **hashStr);
#if PRAGMA_IMPORT_SUPPORTED
#pragma import reset
#endif
PGP_END_C_DECLARATIONS
#endif /* ] Included_pgpLicenseAuthorization_h */
/*__Editor_settings____
Local Variables:
tab-width: 4
End:
vi: ts=4 sw=4
vim: si
_____________________*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -