Skip to content

Commit

Permalink
Add some error code constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Larine committed Jan 30, 2024
1 parent 1fdc6c6 commit 8b5dc9a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/WinAPI/NativeMethods/Crypt32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,8 +1690,7 @@ public struct CRYPT_ALGORITHM_IDENTIFIER
/// <summary>
/// An OID of an algorithm
/// </summary>
// [MarshalAs(UnmanagedType.LPStr)]
public nint pszObjId;
public byte* pszObjId;

/// <summary>
/// A BLOB that provides encoded algorithm-specific parameters. In many cases, there are no parameters. This is indicated by setting the cbData member of the Parameters BLOB to zero.
Expand Down
71 changes: 57 additions & 14 deletions src/WinAPI/NativeMethods/ErrorCodes.Cryptography.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ public static partial class ErrorCodes
/// </summary>
public const uint NTE_ENCRYPTION_FAILURE = 0x80090034;


/// <summary>
/// An error occurred while performing an operation on a cryptographic message.
/// </summary>
public const uint CRYPT_E_MSG_ERROR = 0x80091001;

/// <summary>
/// Cannot find the original signer.
/// </summary>
Expand All @@ -285,11 +291,58 @@ public static partial class ErrorCodes
/// </summary>
public const uint CRYPT_E_REVOKED = 0x80092010;

/// <summary>
/// The revocation function was unable to check revocation because the revocation server was offline.
/// </summary>
public const uint CRYPT_E_REVOCATION_OFFLINE = 0x80092013;

/// <summary>
/// ASN1 end of data expected.
/// </summary>
public const uint CRYPT_E_ASN1_NOEOD = 0x80093202;


/// <summary>
/// A system-level error occurred while verifying trust.
/// </summary>
public const uint TRUST_E_SYSTEM_ERROR = 0x80096001;

/// <summary>
/// The certificate for the signer of the message is invalid or not found.
/// </summary>
public const uint TRUST_E_NO_SIGNER_CERT = 0x80096002;

/// <summary>
/// One of the counter signatures was invalid.
/// </summary>
public const uint TRUST_E_COUNTER_SIGNER = 0x80096003;

/// <summary>
/// The signature of the certificate cannot be verified.
/// </summary>
public const uint TRUST_E_CERT_SIGNATURE = 0x80096004;

/// <summary>
/// The timestamp signature and/or certificate could not be verified or is malformed.
/// </summary>
public const uint TRUST_E_TIME_STAMP = 0x80096005;

/// <summary>
/// The digital signature of the object did not verify.
/// </summary>
public const uint TRUST_E_BAD_DIGEST = 0x80096010;

/// <summary>
/// A certificate's basic constraint extension has not been observed.
/// </summary>
public const uint TRUST_E_BASIC_CONSTRAINTS = 0x80096019;

/// <summary>
/// The certificate does not meet or contain the Authenticode(tm) financial extensions.
/// </summary>
public const uint TRUST_E_FINANCIAL_CRITERIA = 0x8009601E;


/// <summary>
/// A certification chain processed correctly but terminated in a root certificate that is not trusted by the trust provider.
/// </summary>
Expand Down Expand Up @@ -325,30 +378,20 @@ public static partial class ErrorCodes
/// </summary>
public const uint CERT_E_INVALID_POLICY = 0x800B0113;

/// <summary>
/// The basic constraints of the certificate are not valid, or they are missing.
/// </summary>
public const uint TRUST_E_BASIC_CONSTRAINTS = 0x80096019;

/// <summary>
/// The validity periods of the certification chain do not nest correctly.
/// </summary>
public const uint CERT_E_CRITICAL = 0x800B0102;

/// <summary>
/// The validity periods of the certification chain do not nest correct
/// </summary>
public const uint CERT_E_VALIDITYPERIODNESTING = 0x800B0102;

/// <summary>
/// The revocation function was unable to check revocation for the certificate.
/// A certificate contains an unknown extension that is marked 'critical'.
/// </summary>
public const uint CRYPT_E_NO_REVOCATION_CHECK = 0x80092012;
public const uint CERT_E_CRITICAL = 0x800B0105;

/// <summary>
/// The revocation function was unable to check revocation because the revocation server was offline.
/// The revocation function was unable to check revocation for the certificate.
/// </summary>
public const uint CRYPT_E_REVOCATION_OFFLINE = 0x80092013;
public const uint CRYPT_E_NO_REVOCATION_CHECK = 0x80092012;

/// <summary>
/// The certificate is being used for a purpose other than one specified by the issuing CA.
Expand Down

0 comments on commit 8b5dc9a

Please sign in to comment.