Documentation ¶
Index ¶
Constants ¶
View Source
const WireHeaderSize uint16 = wireHeaderSizeValue + 6
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OpCode ¶
type OpCode uint32
OpCode type for parsec operations
const ( OpPing OpCode = 0x0001 OpPsaGenerateKey OpCode = 0x0002 OpPsaDestroyKey OpCode = 0x0003 OpPsaSignHash OpCode = 0x0004 OpPsaVerifyHash OpCode = 0x0005 OpPsaImportKey OpCode = 0x0006 OpPsaExportPublicKey OpCode = 0x0007 OpListProviders OpCode = 0x0008 OpListOpcodes OpCode = 0x0009 OpPsaAsymmetricEncrypt OpCode = 0x000A OpPsaAsymmetricDecrypt OpCode = 0x000B OpPsaExportKey OpCode = 0x000C OpPsaGenerateRandom OpCode = 0x000D OpListAuthenticators OpCode = 0x000E OpPsaHashCompute OpCode = 0x000F OpPsaHashCompare OpCode = 0x0010 OpPsaAeadEncrypt OpCode = 0x0011 OpPsaAeadDecrypt OpCode = 0x0012 OpPsaRawKeyAgreement OpCode = 0x0013 OpPsaCipherEncrypt OpCode = 0x0014 OpPsaCipherDecrypt OpCode = 0x0015 OpPsaMacCompute OpCode = 0x0016 OpPsaMacVerify OpCode = 0x0017 OpPsaSignMessage OpCode = 0x0018 OpPsaVerifyMessage OpCode = 0x0019 OpListKeys OpCode = 0x001A OpListClients OpCode = 0x001B OpDeleteClient OpCode = 0x001C )
Operation Codes
type ProviderID ¶
type ProviderID uint8
ProviderID for providers
const ( ProviderCore ProviderID = 0 ProviderMBed ProviderID = 1 ProviderPKCS11 ProviderID = 2 ProviderTPM ProviderID = 3 ProviderTrustedService ProviderID = 4 )
Provider UUIDs
func (ProviderID) HasCrypto ¶
func (p ProviderID) HasCrypto() bool
HasCrypto returns true if the provider supports crypto
func (ProviderID) IsValid ¶
func (p ProviderID) IsValid() bool
func (ProviderID) String ¶
func (p ProviderID) String() string
type Request ¶
type Request struct { Header wireHeader Body RequestBody Auth auth.RequestAuthToken }
Request represents a Parsec request
func NewRequest ¶
func NewRequest(op OpCode, bdy proto.Message, authenticator auth.Authenticator, provider ProviderID) (*Request, error)
NewRequest creates a new request based on the opcode and the message.
type RequestBody ¶
RequestBody represents a marshaled request body
type StatusCode ¶
type StatusCode uint16
StatusCode type to represent status codes in response headers
const ( // Service Internal Response Status Codes StatusSuccess StatusCode = 0 // Operation was a success StatusWrongProviderID StatusCode = 1 // Requested provider ID does not match that of the backend StatusContentTypeNotSupported StatusCode = 2 // Requested content type is not supported by the backend StatusAcceptTypeNotSupported StatusCode = 3 // Requested accept type is not supported by the backend StatusWireProtocolVersionNotSupported StatusCode = 4 // Requested version is not supported by the backend StatusProviderNotRegistered StatusCode = 5 // No provider registered for the requested provider ID StatusProviderDoesNotExist StatusCode = 6 // No provider defined for requested provider ID StatusDeserializingBodyFailed StatusCode = 7 // Failed to deserialize the body of the message StatusSerializingBodyFailed StatusCode = 8 // Failed to serialize the body of the message StatusOpcodeDoesNotExist StatusCode = 9 // Requested operation is not defined StatusResponseTooLarge StatusCode = 10 // Response size exceeds allowed limits StatusAuthenticationError StatusCode = 11 // Authentication failed StatusAuthenticatorDoesNotExist StatusCode = 12 // Authenticator not supported StatusAuthenticatorNotRegistered StatusCode = 13 // Authenticator not supported StatusKeyInfoManagerError StatusCode = 14 // Internal error in the Key Info Manager StatusConnectionError StatusCode = 15 // Generic input/output error StatusInvalidEncoding StatusCode = 16 // Invalid value for this data type StatusInvalidHeader StatusCode = 17 // Constant fields in header are invalid StatusWrongProviderUUID StatusCode = 18 // The UUID vector needs to only contain 16 bytes StatusNotAuthenticated StatusCode = 19 // Request did not provide a required authentication StatusBodySizeExceedsLimit StatusCode = 20 // Request length specified in the header is above defined limit StatusAdminOperation StatusCode = 21 // The operation requires admin privilege StatusPsaErrorGenericError StatusCode = 1132 // An error occurred that does not correspond to any defined failure cause StatusPsaErrorNotPermitted StatusCode = 1133 // The requested action is denied by a policy StatusPsaErrorNotSupported StatusCode = 1134 // The requested operation or a parameter is not supported by this implementation StatusPsaErrorInvalidArgument StatusCode = 1135 // The parameters passed to the function are invalid StatusPsaErrorInvalidHandle StatusCode = 1136 // The key handle is not valid StatusPsaErrorBadState StatusCode = 1137 // The requested action cannot be performed in the current state StatusPsaErrorBufferTooSmall StatusCode = 1138 // An output buffer is too small StatusPsaErrorAlreadyExists StatusCode = 1139 // Asking for an item that already exists StatusPsaErrorDoesNotExist StatusCode = 1140 // Asking for an item that doesn't exist StatusPsaErrorInsufficientMemory StatusCode = 1141 // There is not enough runtime memory StatusPsaErrorInsufficientStorage StatusCode = 1142 // There is not enough persistent storage available StatusPsaErrorInssuficientData StatusCode = 1143 // Insufficient data when attempting to read from a resource StatusPsaErrorCommunicationFailure StatusCode = 1145 // There was a communication failure inside the implementation StatusPsaErrorStorageFailure StatusCode = 1146 // There was a storage failure that may have led to data loss StatusPsaErrorHardwareFailure StatusCode = 1147 // A hardware failure was detected StatusPsaErrorInsufficientEntropy StatusCode = 1148 // There is not enough entropy to generate random data needed for the requested action StatusPsaErrorInvalidSignature StatusCode = 1149 // The signature, MAC or hash is incorrect StatusPsaErrorInvalidPadding StatusCode = 1150 // The decrypted padding is incorrect StatusPsaErrorCorruptionDetected StatusCode = 1151 // A tampering attempt was detected StatusPsaErrorDataCorrupt StatusCode = 1152 // Stored data has been corrupted )
StatusCode values for response status codes defined here: https://parallaxsecond.github.io/parsec-book/parsec_client/status_codes.html.
func (StatusCode) IsValid ¶
func (code StatusCode) IsValid() bool
func (StatusCode) ToErr ¶
func (code StatusCode) ToErr() error
ToErr returns nil if the response code is a success, or an appropriate error otherwise.
Click to show internal directories.
Click to hide internal directories.