📄 pgpclientencode.c
字号:
{
optionList = kPGPOutOfMemoryOptionListRef;
}
return( optionList );
}
PGPOptionListRef
PGPOSendNullEvents(
PGPContextRef context,
PGPTimeInterval approxInterval)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asInterval = approxInterval;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_SendNullEvents,
&value, sizeof( approxInterval ), NULL );
return( optionList );
}
PGPOptionListRef
PGPOArmorOutput(
PGPContextRef context,
PGPBoolean armorOutput
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)armorOutput;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_ArmorOutput,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPODataIsASCII(
PGPContextRef context,
PGPBoolean dataIsASCII
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)dataIsASCII;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_DataIsASCII,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOClearSign(
PGPContextRef context,
PGPBoolean clearSign
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)clearSign;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_ClearSign,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOForYourEyesOnly(
PGPContextRef context,
PGPBoolean forYourEyesOnly
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)forYourEyesOnly;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_ForYourEyesOnly,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOSendEventIfKeyFound(
PGPContextRef context,
PGPBoolean sendEventIfKeyFound
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)sendEventIfKeyFound;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_SendEventIfKeyFound,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOPassThroughIfUnrecognized(
PGPContextRef context,
PGPBoolean passThroughIfUnrecognized
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)passThroughIfUnrecognized;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_PassThroughIfUnrecognized,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOPassThroughClearSigned(
PGPContextRef context,
PGPBoolean passThroughClearSigned
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)passThroughClearSigned;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_PassThroughClearSigned,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOPassThroughKeys(
PGPContextRef context,
PGPBoolean passThroughKeys
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)passThroughKeys;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_PassThroughKeys,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPORecursivelyDecode(
PGPContextRef context,
PGPBoolean recurse
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)recurse;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_RecursivelyDecode,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOAskUserForEntropy(
PGPContextRef context,
PGPBoolean askUserForEntropy
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)askUserForEntropy;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_AskUserForEntropy,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPORawPGPInput(
PGPContextRef context,
PGPBoolean rawPGPInput
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)rawPGPInput;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_RawPGPInput,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOCompression(
PGPContextRef context,
PGPBoolean compression
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = (PGPUInt32)compression;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_Compression,
&value, sizeof( PGPUInt32 ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOKeyDBRef(
PGPContextRef context,
PGPKeyDBRef keyDBRef)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeyDBIsValid( keyDBRef ) );
pgpEnterOptionListFunction();
value.asKeyDBRef = keyDBRef;
PGPIncKeyDBRefCount( keyDBRef );
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_KeyDBRef,
&value, sizeof( keyDBRef ),
SpecialOptionHandlerProc );
return( optionList );
}
PGPOptionListRef
PGPOExportKeySet(
PGPContextRef context,
PGPKeySetRef keySetRef)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeySetIsValid( keySetRef ) );
pgpEnterOptionListFunction();
value.asKeySetRef = keySetRef;
PGPIncKeySetRefCount( keySetRef );
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_ExportKeySet,
&value, sizeof( keySetRef ),
SpecialOptionHandlerProc );
return( optionList );
}
PGPOptionListRef
PGPOExportKeyDBObj(
PGPContextRef context,
PGPKeyDBObjRef objRef)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeyDBObjIsValid( objRef ) );
pgpEnterOptionListFunction();
value.asKeyDBObjRef = objRef;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_ExportKeyDBObj,
&value, sizeof( objRef ),
SpecialOptionHandlerProc );
return( optionList );
}
PGPOptionListRef
PGPOKeyGenParams(
PGPContextRef context,
PGPPublicKeyAlgorithm pubKeyAlg,
PGPUInt32 bits)
{
PGPOptionListRef optionList;
PGPOKeyGenParamsDesc *descriptor;
pgpValidateOptionContext( context );
if( pubKeyAlg == kPGPPublicKeyAlgorithm_ECSign ||
pubKeyAlg == kPGPPublicKeyAlgorithm_ECEncrypt )
{
pgpValidateOptionParam( bits >= 163 );
} else {
pgpValidateOptionParam( bits >= 512 );
}
pgpEnterOptionListFunction();
descriptor = (PGPOKeyGenParamsDesc *)
pgpContextMemAlloc( context, sizeof(*descriptor), 0);
if( IsntNull( descriptor ) )
{
PGPOptionValue value;
descriptor->pkalg = pubKeyAlg;
descriptor->bits = bits;
value.asPtr = descriptor;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_KeyGenParams,
&value, sizeof( *descriptor ),
AllocatedOptionHandlerProc );
}
else
{
optionList = kPGPOutOfMemoryOptionListRef;
}
return( optionList );
}
PGPOptionListRef
PGPOKeyGenName(
PGPContextRef context,
const void * name,
PGPSize nameLength)
{
pgpValidateOptionContext( context );
pgpValidateOptionParam( IsntNull( name ) );
pgpValidateOptionParam( nameLength >= 1 );
pgpValidateOptionParam( nameLength < 256 );
pgpEnterOptionListFunction();
return( pgpCreateBufferOptionList( context,
kPGPOptionType_KeyGenName, name, nameLength ) );
}
PGPOptionListRef
PGPOExpiration(
PGPContextRef context,
PGPUInt32 expirationDays)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asUInt = expirationDays;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_Expiration,
&value, sizeof( expirationDays ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOCreationDate(
PGPContextRef context,
PGPTime creationDate)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpEnterOptionListFunction();
value.asTime = creationDate;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_CreationDate,
&value, sizeof( creationDate ), NULL);
return( optionList );
}
PGPOptionListRef
PGPOAdditionalRecipientRequestKeySet(
PGPContextRef context,
PGPKeySetRef arKeySetRef,
PGPByte arkclass
)
{
PGPOptionListRef optionList;
PGPOAdditionalRecipientRequestKeySetDesc *descriptor;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeySetIsValid( arKeySetRef ) );
pgpEnterOptionListFunction();
descriptor = (PGPOAdditionalRecipientRequestKeySetDesc *)
pgpContextMemAlloc( context, sizeof(*descriptor), 0);
if( IsntNull( descriptor ) )
{
PGPOptionValue value;
descriptor->arKeySetRef = arKeySetRef;
descriptor->arkclass = arkclass;
value.asPtr = descriptor;
PGPIncKeySetRefCount( arKeySetRef );
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_AdditionalRecipientRequestKeySet,
&value, sizeof( *descriptor ),
AllocatedOptionHandlerProc );
}
else
{
optionList = kPGPOutOfMemoryOptionListRef;
}
return( optionList );
}
PGPOptionListRef
PGPORevocationKeySet(
PGPContextRef context,
PGPKeySetRef raKeySetRef
)
{
PGPOptionListRef optionList;
PGPOAdditionalRecipientRequestKeySetDesc *descriptor;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeySetIsValid( raKeySetRef ) );
pgpEnterOptionListFunction();
/* Use ADK descriptor as we have similar data structure */
descriptor = (PGPOAdditionalRecipientRequestKeySetDesc *)
pgpContextMemAlloc( context, sizeof(*descriptor), 0);
if( IsntNull( descriptor ) )
{
PGPOptionValue value;
descriptor->arKeySetRef = raKeySetRef;
descriptor->arkclass = 0x80; /* hard code value for revocation */
value.asPtr = descriptor;
PGPIncKeySetRefCount( raKeySetRef );
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_RevocationKeySet,
&value, sizeof( *descriptor ),
AllocatedOptionHandlerProc );
}
else
{
optionList = kPGPOutOfMemoryOptionListRef;
}
return( optionList );
}
PGPOptionListRef
PGPOKeyGenMasterKey(
PGPContextRef context,
PGPKeyDBObjRef masterKeyRef
)
{
PGPOptionListRef optionList;
PGPOptionValue value;
pgpValidateOptionContext( context );
pgpValidateOptionParam( pgpKeyIsValid( masterKeyRef ) );
pgpEnterOptionListFunction();
value.asKeyDBObjRef = masterKeyRef;
optionList = pgpCreateStandardValueOptionList( context,
kPGPOptionType_KeyGenMasterKey,
&value, sizeof( masterKeyRef ),
SpecialOptionHandlerProc );
return( optionList );
}
PGPOptionListRef
PGPOPreferredAlgorithms(
PGPContextRef context,
PGPCipherAlgorithm const * prefAlg,
PGPUInt32 numAlgs)
{
pgpValidateOptionContext( context );
pgpValidateOptionParam( IsntNull( prefAlg ) );
pgpValidateOptionParam( numAlgs != 0 );
pgpEnterOptionListFunction();
return( pgpCreateBufferOptionList( context,
kPGPOptionType_PreferredAlgorithms,
prefAlg, numAlgs * sizeof( prefAlg[ 0 ] ) ) );
}
PGPOptionListRef
PGPOPreferredKeyServer(
PGPContextRef context,
char const * server )
{
pgpValidateOptionContext( context );
pgpValidateOptionParam( IsntNull( server ) );
pgpEnterOptionListFunction();
return( pgpCreateBufferOptionList( context,
kPGPOptionType_PreferredKeyServer,
(PGPByte const *)server, strlen(server) ) );
}
PGPOptionListRef
PGPOKeyFlags(
PGPContextRef context,
PGPUInt32 flags)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -