github.com/cactusblossom/fabric-ca@v0.0.0-20200611062428-0082fc643826/api/net.go (about) 1 /* 2 Copyright IBM Corp. 2016 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package api 18 19 import ( 20 "github.com/cloudflare/cfssl/signer" 21 "github.com/hyperledger/fabric/idemix" 22 ) 23 24 /* 25 * This file contains the structure definitions for the request 26 * and responses which flow over the network between a fabric-ca client 27 * and the fabric-ca server. 28 */ 29 30 // RegistrationRequestNet is the registration request for a new identity 31 type RegistrationRequestNet struct { 32 RegistrationRequest 33 } 34 35 // RegistrationResponseNet is a registration response 36 type RegistrationResponseNet struct { 37 RegistrationResponse 38 } 39 40 // EnrollmentRequestNet is a request to enroll an identity 41 type EnrollmentRequestNet struct { 42 signer.SignRequest 43 CAName string 44 AttrReqs []*AttributeRequest `json:"attr_reqs,omitempty"` 45 } 46 47 // IdemixEnrollmentRequestNet is a request to enroll an identity and get idemix credential 48 type IdemixEnrollmentRequestNet struct { 49 *idemix.CredRequest `json:"request"` 50 CAName string `json:"caname"` 51 } 52 53 // ReenrollmentRequestNet is a request to reenroll an identity. 54 // This is useful to renew a certificate before it has expired. 55 type ReenrollmentRequestNet struct { 56 signer.SignRequest 57 CAName string 58 AttrReqs []*AttributeRequest `json:"attr_reqs,omitempty"` 59 } 60 61 // RevocationRequestNet is a revocation request which flows over the network 62 // to the fabric-ca server. 63 // To revoke a single certificate, both the Serial and AKI fields must be set; 64 // otherwise, to revoke all certificates and the identity associated with an enrollment ID, 65 // the Name field must be set to an existing enrollment ID. 66 // A RevocationRequest can only be performed by a user with the "hf.Revoker" attribute. 67 type RevocationRequestNet struct { 68 RevocationRequest 69 } 70 71 // GetTCertBatchRequestNet is a network request for a batch of transaction certificates 72 type GetTCertBatchRequestNet struct { 73 GetTCertBatchRequest 74 // KeySigs is an optional array of public keys and corresponding signatures. 75 // If not set, the server generates it's own keys based on a key derivation function 76 // which cryptographically relates the TCerts to an ECert. 77 KeySigs []KeySig `json:"key_sigs,omitempty"` 78 } 79 80 // GetTCertBatchResponseNet is the network response for a batch of transaction certificates 81 type GetTCertBatchResponseNet struct { 82 GetTCertBatchResponse 83 } 84 85 // AddIdentityRequestNet is a network request for adding a new identity 86 type AddIdentityRequestNet struct { 87 AddIdentityRequest 88 } 89 90 // ModifyIdentityRequestNet is a network request for modifying an existing identity 91 type ModifyIdentityRequestNet struct { 92 ModifyIdentityRequest 93 } 94 95 // AddAffiliationRequestNet is a network request for adding a new affiliation 96 type AddAffiliationRequestNet struct { 97 AddAffiliationRequest 98 } 99 100 // ModifyAffiliationRequestNet is a network request for modifying an existing affiliation 101 type ModifyAffiliationRequestNet struct { 102 ModifyAffiliationRequest 103 } 104 105 // GetCertificatesRequestNet is a network request for getting certificates 106 type GetCertificatesRequestNet struct { 107 GetCertificatesRequest 108 } 109 110 // KeySig is a public key, signature, and signature algorithm tuple 111 type KeySig struct { 112 // Key is a public key 113 Key []byte `json:"key"` 114 // Sig is a signature over the PublicKey 115 Sig []byte `json:"sig"` 116 // Alg is the signature algorithm 117 Alg string `json:"alg"` 118 }