github.com/hxx258456/fabric-ca-gm@v0.0.3-0.20221111064038-a268ad7e3a37/internal/pkg/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/hxx258456/cfssl-gm/signer" 21 "github.com/hxx258456/fabric-gm/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 // AddIdentityRequestNet is a network request for adding a new identity 72 type AddIdentityRequestNet struct { 73 AddIdentityRequest 74 } 75 76 // ModifyIdentityRequestNet is a network request for modifying an existing identity 77 type ModifyIdentityRequestNet struct { 78 ModifyIdentityRequest 79 } 80 81 // AddAffiliationRequestNet is a network request for adding a new affiliation 82 type AddAffiliationRequestNet struct { 83 AddAffiliationRequest 84 } 85 86 // ModifyAffiliationRequestNet is a network request for modifying an existing affiliation 87 type ModifyAffiliationRequestNet struct { 88 ModifyAffiliationRequest 89 } 90 91 // GetCertificatesRequestNet is a network request for getting certificates 92 type GetCertificatesRequestNet struct { 93 GetCertificatesRequest 94 } 95 96 // KeySig is a public key, signature, and signature algorithm tuple 97 type KeySig struct { 98 // Key is a public key 99 Key []byte `json:"key"` 100 // Sig is a signature over the PublicKey 101 Sig []byte `json:"sig"` 102 // Alg is the signature algorithm 103 Alg string `json:"alg"` 104 }