
    >                         S r SSKrSSKJr  SSKJr  Sr " S S\R                  5      r " S S\R                  5      r	 " S	 S
\R                  5      r
S rS rS rS rg)z.Helpers for End to End integirty verification.    N)
exceptionszPlease try again. This should happen rarely. If the error persists, contact cloudkms-feedback@google.com. To learn more about how Cloud KMS verifies in-transit integrity, visit https://cloud.google.com/kms/docs/data-integrity-guidelines.c                       \ rS rSrSrSrg)$ServerSideIntegrityVerificationError   z?Error raised when server reported integrity verification error. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       3lib/googlecloudsdk/command_lib/kms/e2e_integrity.pyr   r      s    Gr   r   c                       \ rS rSrSrSrg)$ClientSideIntegrityVerificationError"   zAError raised when client identifies integrity verification error.r   Nr   r   r   r   r   r   "   s    Ir   r   c                       \ rS rSrSrSrg)ResourceNameVerificationError&   z[Error raised when server returned resource name differs from client provided resource name.r   Nr   r   r   r   r   r   &   s    cr   r   c                  ,    SR                  [        5      $ )zGError message for when the request to server failed an integrity check.z;The request sent to the server was corrupted in-transit. {}format_ERROR_MESSAGE_SUFFIXr   r   r   'GetRequestToServerCorruptedErrorMessager   *   s     H
N
N r   c                  ,    SR                  [        5      $ )zJError message for when the response from server failed an integrity check.zBThe response received from the server was corrupted in-transit. {}r   r   r   r   *GetResponseFromServerCorruptedErrorMessager   1   s     O6'(*r   c                 V    SR                  U 5      SR                  U5      -   [        -   $ )Nz<Found a mismatch between user-requested crypto resource ({})zHand server-reported resource used for the cryptographic operation ({}).
r   )request_resource_nameresponse_resource_names     r   #GetResourceNameMismatchErrorMessager!   8   s8     EKK
!Qv$%& )>>?r   c                     [         R                  " U 5      n[        R                  " S5      nUR	                  UR
                  R                  5      b  [        [        5       5      eUe)a  Intercept INVALID_ARGUMENT errors related to checksum verification.

Intercept INVALID_ARGUMENT errors related to checksum verification, to present
a user-friendly message.
All other errors are surfaced as-is.
Args:
  error: apitools_exceptions.ProcessHttpBadRequestError.

Raises:
  ServerSideIntegrityVerificationError: if |error| is a result of a failed
  server-side request integrity verification.
  Else, re-raises |error| as exceptions.HttpException.
z<The checksum in field .* did not match the data in field .*.)	r   HttpExceptionrecompilesearchpayloadstatus_messager   r   )errorexcregexs      r   ProcessHttpBadRequestErrorr,   B   sY     	  '#
**DF%
\\#++,,-9
./13 3 Ir   )r   r$   googlecloudsdk.callioper   googlecloudsdk.corecore_exceptionsr   Errorr   r   r   r   r   r!   r,   r   r   r   <module>r1      sp    5 
 . =C H?+@+@ HJ?+@+@ JdO$9$9 d*?r   