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

📄 pgperrors.c

📁 vc环境下的pgp源码
💻 C
📖 第 1 页 / 共 2 页
字号:
EN( kPGPError_ItemIsReadOnly,		"object is read-only"),
EN( kPGPError_InvalidProperty,		"invalid property name"),
EN( kPGPError_FileCorrupt,			"key database is corrupt"),
EN( kPGPError_UnknownVersion,		"unknown version"),
EN( kPGPError_DuplicateCert,			"duplicate certification"),
EN( kPGPError_DuplicateUserID,		"duplicate UserID"),
EN( kPGPError_CertifyingKeyDead,		"certifying key no longer valid"),
EN( kPGPError_ItemWasDeleted,		"Object has been deleted"),

/*	Certificate Server error codes */
EN( kPGPError_ServerInProgress,	"server operation in progress"),
EN( kPGPError_ServerOperationNotSupported,	"server operation not supported"),
EN( kPGPError_ServerInvalidProtocol,	"invalid server protocol"),
EN( kPGPError_ServerRequestFailed,	"the request was rejected by the server"),
EN( kPGPError_ServerOpen,	"server already open"),
EN( kPGPError_ServerNotOpen, "server not open"),
EN( kPGPError_ServerKeyAlreadyExists,
								"the exact key already exists on the server"),
EN( kPGPError_ServerNotInitialized,	"server not initialized"),
EN( kPGPError_ServerPartialAddFailure,
								"some keys could not be added to the server"),
EN( kPGPError_ServerCorruptKeyBlock,	"corrupt keyblock"),
EN( kPGPError_ServerUnknownResponse, "unknown response from server"),
EN( kPGPError_ServerTimedOut,	"server request timed out"),
EN( kPGPError_ServerOpenFailed,		"server open failed"),
EN( kPGPError_ServerAuthorizationRequired, 
								"authorization required for this operation"),
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_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")

};
#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 + -