⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgperrors.c

📁 可以实现对邮件的加密解密以及签名
💻 C
📖 第 1 页 / 共 2 页
字号:
EN( kPGPError_ServerAuthorizationFailed, 
									"authorization failed for this operation"),
EN( kPGPError_ServerSearchFailed,	"server search failed"),
EN( kPGPError_ServerPartialSearchResults,	"server returned partial results"),
EN( kPGPError_ServerBadKeysInSearchResults,
								"the server returned 1 or more corrupt keys"),
EN( kPGPError_ServerKeyFailedPolicy, "the key failed the server policy check"),
EN( kPGPError_ServerOperationRequiresTLS, "the operation requires TLS"),
EN( kPGPError_ServerNoStaticStorage,
		"server static storage not allocated for thread"),

/* TLS error codes */
EN( kPGPError_TLSUnexpectedClose,
								"the TLS connection was unexpectedly shutdown"),
EN( kPGPError_TLSProtocolViolation,
					"the remote system violated the TLS connection protocol"),
EN( kPGPError_TLSVersionUnsupported,
					"the TLS version of the remote system is not compatible"),
EN( kPGPError_TLSWrongState,
					"the remote system violated the TLS handshake sequence"),
EN( kPGPError_TLSAlertReceived, "the remote system aborted the TLS connection"),
EN( kPGPError_TLSKeyUnusable,
					"the selected key is not capable of TLS authentication."),
EN( kPGPError_TLSNoCommonCipher,
			"the encryption suggested by the remote TLS system is not usable"),
EN( kPGPError_TLSWouldBlock,
			"TLS would block"),
EN( kPGPError_TLSRcvdHandshakeRequest,
			"the remote system requested a renegotiation of the key schedules"),

/* Sockets error codes */
EN( kPGPError_SocketsNetworkDown,	"network down"),
EN( kPGPError_SocketsNotInitialized, "sockets not initialized"),
EN( kPGPError_SocketsInProgress,	"sockets call already in progress"),
EN( kPGPError_SocketsNotConnected,	"socket is not connected"),
EN( kPGPError_SocketsNotBound, "socket has not been bound"),
EN( kPGPError_SocketsOperationNotSupported,
									"operation not supported on this socket"),
EN( kPGPError_SocketsProtocolNotSupported,
									"protocol not supported by sockets"),
EN( kPGPError_SocketsAddressFamilyNotSupported,
									"address family not supported by sockets"),
EN( kPGPError_SocketsNotASocket,	"not a socket"),
EN( kPGPError_SocketsAddressInUse,	"address already in use by another socket"),
EN( kPGPError_SocketsBufferOverflow,	"buffer overflow"),
EN( kPGPError_SocketsListenQueueFull,	"listen queue is full"),
EN( kPGPError_SocketsAddressNotAvailable,	"address not available to socket"),
EN( kPGPError_SocketsAlreadyConnected,	"socket is already connected"),
EN( kPGPError_SocketsTimedOut,	"socket timed out during operation"),
EN( kPGPError_SocketsHostNotFound,	"host not found"),
EN( kPGPError_SocketsDomainServerError,	"error in domain name system"),
EN( kPGPError_SocketsNoStaticStorage,
		"sockets static storage not allocated for thread"),

/* X.509 errors */
EN( kPGPError_X509AttributeNotSupported,  "unsupported X.509 attribute"),
EN( kPGPError_InvalidPKCS7Encoding,  "Unable to parse PKCS-7 data"),
EN( kPGPError_CMSInitialization,  "Unable to initialize CMS"),
EN( kPGPError_InvalidDistinguishedName,
	"invalid character in X.509 distinguished name"),
EN( kPGPError_CertRequestCreationFailure,  "tc_create_request() failed"),
EN( kPGPError_MissingX509Certificate,
	"Unable to locate x.509 cert associated with key"),
EN( kPGPError_PKCS7SignFailure,
	"Error occured while attempting to sign PKCS-7 message"),
EN( kPGPError_ASNPackFailure,  "Failure while packing ASN.1 data"),
EN( kPGPError_InvalidInputFormat,  "Unknown PGPInputFormat"),
EN( kPGPError_InvalidOutputFormat,  "Unknown PGPOutputFormat"),

EN(	kPGPError_BadSignature, "bad signature"),
EN(	kPGPError_BigNumNoInverse, "no inverse big number"),
EN(	kPGPError_CRLPacketTruncated, "truncated CRL packet"),
EN(	kPGPError_CRSInvalidAttributeType, "invalid attribute type"),
EN(	kPGPError_CRSInvalidAttributeValueLength, "invalid attribute length"),
EN(	kPGPError_CRSInvalidAuthenticateValue, "invalid authenticated value"),
EN(	kPGPError_CRSInvalidCertType, "invalid certificate type"),
EN(	kPGPError_CRSInvalidCharacter, "invalid character"),
EN(	kPGPError_CRSMissingRequiredAttribute, "missing required attribute"),
EN(	kPGPError_InvalidCertificateExtension, "invalid certificate extension"),
EN(	kPGPError_KeyDBMismatch, "mismatched key databases"),
EN(	kPGPError_KeyTooLarge, "key too large"),
EN( kPGPError_CorruptPrivateKey, "private key data has been altered"),
EN(	kPGPError_RevocationKeyNotFound, "revocation key not found"),
EN(	kPGPError_SelfTestsNotExecuted, "self tests have not been executed"),
EN(	kPGPError_ServerCertNotFound, "certificate not found"),
EN(	kPGPError_TroubleCRLTooBig, "CRL too large"),
EN(	kPGPError_TroubleDuplicateCRL, "duplicate CRL"),
EN(	kPGPError_TroubleImportingNonexportableSignature, "found non-exportable signature during import"),
EN(	kPGPError_UnknownString2Key, "unknown key string"),
EN(	kPGPError_UnsupportedNetToolsCAFilter, "unsupported filter type"),
EN(	kPGPError_X509InvalidCertificateFormat, "invalid certificate format"),
EN(	kPGPError_X509InvalidCertificateSignature, "invalid certificate signature"),
EN(	kPGPError_X509NeededCertNotAvailable, "required certificate not found"),
EN(	kPGPError_X509SelfSignedCert, "found unexpected self-signed certificate"),

/* LDAP Errors */
EN( kPGPError_LDAPOperationsError, "Operations error"),
EN( kPGPError_LDAPProtocolError, "Protocol error"),
EN( kPGPError_LDAPTimelimitExceeded, "Time limit exceeded"),
EN( kPGPError_LDAPSizelimitExceeded, "Size limit exceeded"),
EN( kPGPError_LDAPStrongAuthNotSupported, "Strong authentication not supported"),
EN( kPGPError_LDAPStrongAuthRequired, "Strong authentication required"),
EN( kPGPError_LDAPPartialResults, "Partial results and referral received"),
EN( kPGPError_LDAPNoSuchAttribute, "No such attribute"),
EN( kPGPError_LDAPUndefinedType, "Undefined attribute type"),
EN( kPGPError_LDAPInappropriateMatching, "Inappropriate matching"),
EN( kPGPError_LDAPConstraintViolation, "Constraint violation"),
EN( kPGPError_LDAPTypeOrValueExists, "Type or value exists"),
EN( kPGPError_LDAPInvalidSyntax, "Invalid syntax"),
EN( kPGPError_LDAPNoSuchObject, "No such object"),
EN( kPGPError_LDAPAliasProblem, "Alias problem"),
EN( kPGPError_LDAPInvalidDNSyntax, "Invalid DN syntax"),
EN( kPGPError_LDAPIsLeaf, "Object is a leaf"),
EN( kPGPError_LDAPAliasDerefProblem, "Alias dereferencing problem"),
EN( kPGPError_LDAPInappropriateAuth, "Inappropriate authentication"),
EN( kPGPError_LDAPInvalidCredentials, "Invalid credentials"),
EN( kPGPError_LDAPInsufficientAccess, "Insufficient access"),
EN( kPGPError_LDAPBusy, "Server is busy"),
EN( kPGPError_LDAPUnavailable, "Server is unavailable"),
EN( kPGPError_LDAPUnwillingToPerform, "Server is unwilling to perform"),
EN( kPGPError_LDAPLoopDetect, "Loop detected"),
EN( kPGPError_LDAPNamingViolation, "Naming violation"),
EN( kPGPError_LDAPObjectClassViolation, "Object class violation"),
EN( kPGPError_LDAPNotAllowedOnNonleaf, "Operation not allowed on nonleaf"),
EN( kPGPError_LDAPNotAllowedOnRDN, "Operation not allowed on RDN"),
EN( kPGPError_LDAPAlreadyExists, "Already exists"),
EN( kPGPError_LDAPNoObjectClassMods, "Cannot modify object class"),
EN( kPGPError_LDAPResultsTooLarge, "Results too large"),
EN( kPGPError_LDAPOther, "Unknown error"),
EN( kPGPError_LDAPServerDown, "Cannot contact LDAP server"),
EN( kPGPError_LDAPLocalError, "Local error"),
EN( kPGPError_LDAPEncodingError, "Encoding error"),
EN( kPGPError_LDAPDecodingError, "Decoding error"),
EN( kPGPError_LDAPTimeout, "Timed out"),
EN( kPGPError_LDAPAuthUnknown, "Unknown authentication method"),
EN( kPGPError_LDAPFilterError, "Bad search filter"),
EN( kPGPError_LDAPUserCancelled, "User cancelled operation"),
EN( kPGPError_LDAPParamError, "Bad parameter to an LDAP routine"),
EN( kPGPError_LDAPConnectError, "Cannot connect to the LDAP server"),
EN( kPGPError_LDAPNotLDAPURL, "Not an LDAP URL"),
EN( kPGPError_LDAPNoDN, "URL missing required base DN"),
EN( kPGPError_LDAPBadScope, "URL scope is invalid"),
EN( kPGPError_SmartCardError, "Internal error in smart card function"),
EN( kPGPError_SmartCardOutOfMemory, "Insufficient smart card memory to complete operation"),
EN( kPGPError_SmartCardKeyNotFound, "Expected key not found on smart card"),
EN( kPGPError_SmartCardX509Exists, "X509 certificate already exists on the smart card"),
EN( kPGPError_SmartCardKeyExists, "Key already exists on the smart card"),
EN( kPGPError_SmartCardPinLocked, "PIN Locked, no more atempts possible"),
};
#define kPGPErrors_NumErrorTableEntries		\
	( sizeof( sErrors ) / sizeof( sErrors[ 0 ] ) )

#undef EN


	
	PGPError 
PGPGetErrorString(
	PGPError	theError,
	PGPSize		bufferSize,
	char *		theString )
{
	PGPUInt32		idx;
	char			temp[ 256 ];
	char const *	errStr	= NULL;
	PGPSize			len	= 0;
	PGPBoolean		bufferBigEnough	= FALSE;
	
	if (theError >= kPGPPFLErrorBase && theError <= kPGPError_LastPFLError )
		return PGPGetPFLErrorString(theError, bufferSize, theString);

	PGPValidateParam( bufferSize >= 1 );
	PGPValidatePtr( theString );
	*theString	= '\0';
	
	for( idx = 0; idx < kPGPErrors_NumErrorTableEntries; ++idx )
	{
		const ErrorEntry *	entry;
		
		entry	= &sErrors[ idx ];
		if ( entry->number == theError )
		{
			errStr	= entry->string;
			break;
		}
	}
	
	if ( IsNull( errStr ) )
	{
		/* Produce something for missing errors */
		sprintf( temp, "PGPError #%ld", (long)theError );
		errStr	= temp;
	}
	
	len	= strlen( errStr );
	bufferBigEnough	= ( len + 1 <= bufferSize );
	if ( bufferBigEnough )
	{
		strcpy( theString, errStr );
	}
	else
	{
		pgpCopyMemory( errStr, theString, bufferSize - 1 );
		theString[ bufferSize - 1 ]	= '\0';
	}
	
	return( bufferBigEnough	? kPGPError_NoErr : kPGPError_BufferTooSmall );
}



/*__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 + -