Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 591cea8

Browse files
committed
[FAB-6177] Improve Fabric-CA vendoring (populate 1.0.1)
This patch uses the third_party pinning script to populate Fabric CA 1.0.1 dependencies into the SDK. Change-Id: I650850257663f1fde211c80de910684b3289e178 Signed-off-by: Troy Ronda <troy.ronda@securekey.com>
1 parent e82eb25 commit 591cea8

File tree

25 files changed

+3998
-67
lines changed

25 files changed

+3998
-67
lines changed

Gopkg.lock

Lines changed: 4 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
name = "github.com/hyperledger/fabric"
99
branch = "master"
1010

11-
[[constraint]]
12-
name = "github.com/hyperledger/fabric-ca"
13-
version = "~1.0.0"
14-
1511
[[constraint]]
1612
name = "github.com/golang/mock"
1713
version = "^1.0.0"

def/fabapi/pkgfactory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"fmt"
1111
"io/ioutil"
1212

13-
fabricCaUtil "github.com/hyperledger/fabric-ca/util"
1413
config "github.com/hyperledger/fabric-sdk-go/api/apiconfig"
1514
fabca "github.com/hyperledger/fabric-sdk-go/api/apifabca"
1615
fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
16+
fabricCaUtil "github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util"
1717
configImpl "github.com/hyperledger/fabric-sdk-go/pkg/config"
1818
fabricCAClient "github.com/hyperledger/fabric-sdk-go/pkg/fabric-ca-client"
1919
clientImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client"
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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+
"time"
21+
22+
"github.com/cloudflare/cfssl/csr"
23+
"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/lib/tcert"
24+
)
25+
26+
// RegistrationRequest for a new identity
27+
type RegistrationRequest struct {
28+
// Name is the unique name of the identity
29+
Name string `json:"id" help:"Unique name of the identity"`
30+
// Type of identity being registered (e.g. "peer, app, user")
31+
Type string `json:"type" help:"Type of identity being registered (e.g. 'peer, app, user')"`
32+
// Secret is an optional password. If not specified,
33+
// a random secret is generated. In both cases, the secret
34+
// is returned in the RegistrationResponse.
35+
Secret string `json:"secret,omitempty" help:"The enrollment secret for the identity being registered"`
36+
// MaxEnrollments is the maximum number of times the secret can
37+
// be reused to enroll.
38+
MaxEnrollments int `json:"max_enrollments,omitempty" def:"-1" help:"The maximum number of times the secret can be reused to enroll."`
39+
// is returned in the response.
40+
// The identity's affiliation.
41+
// For example, an affiliation of "org1.department1" associates the identity with "department1" in "org1".
42+
Affiliation string `json:"affiliation" help:"The identity's affiliation"`
43+
// Attributes associated with this identity
44+
Attributes []Attribute `json:"attrs,omitempty"`
45+
// CAName is the name of the CA to connect to
46+
CAName string `json:"caname,omitempty" skip:"true"`
47+
}
48+
49+
// RegistrationResponse is a registration response
50+
type RegistrationResponse struct {
51+
// The secret returned from a successful registration response
52+
Secret string `json:"secret"`
53+
}
54+
55+
// EnrollmentRequest is a request to enroll an identity
56+
type EnrollmentRequest struct {
57+
// The identity name to enroll
58+
Name string `json:"name" skip:"true"`
59+
// The secret returned via Register
60+
Secret string `json:"secret,omitempty" skip:"true"`
61+
// Profile is the name of the signing profile to use in issuing the certificate
62+
Profile string `json:"profile,omitempty" help:"Name of the signing profile to use in issuing the certificate"`
63+
// Label is the label to use in HSM operations
64+
Label string `json:"label,omitempty" help:"Label to use in HSM operations"`
65+
// CSR is Certificate Signing Request info
66+
CSR *CSRInfo `json:"csr,omitempty" help:"Certificate Signing Request info"`
67+
// CAName is the name of the CA to connect to
68+
CAName string `json:"caname,omitempty" skip:"true"`
69+
}
70+
71+
// ReenrollmentRequest is a request to reenroll an identity.
72+
// This is useful to renew a certificate before it has expired.
73+
type ReenrollmentRequest struct {
74+
// Profile is the name of the signing profile to use in issuing the certificate
75+
Profile string `json:"profile,omitempty"`
76+
// Label is the label to use in HSM operations
77+
Label string `json:"label,omitempty"`
78+
// CSR is Certificate Signing Request info
79+
CSR *CSRInfo `json:"csr,omitempty"`
80+
// CAName is the name of the CA to connect to
81+
CAName string `json:"caname,omitempty" skip:"true"`
82+
}
83+
84+
// RevocationRequest is a revocation request for a single certificate or all certificates
85+
// associated with an identity.
86+
// To revoke a single certificate, both the Serial and AKI fields must be set;
87+
// otherwise, to revoke all certificates and the identity associated with an enrollment ID,
88+
// the Name field must be set to an existing enrollment ID.
89+
// A RevocationRequest can only be performed by a user with the "hf.Revoker" attribute.
90+
type RevocationRequest struct {
91+
// Name of the identity whose certificates should be revoked
92+
// If this field is omitted, then Serial and AKI must be specified.
93+
Name string `json:"id,omitempty" opt:"e" help:"Identity whose certificates should be revoked"`
94+
// Serial number of the certificate to be revoked
95+
// If this is omitted, then Name must be specified
96+
Serial string `json:"serial,omitempty" opt:"s" help:"Serial number of the certificate to be revoked"`
97+
// AKI (Authority Key Identifier) of the certificate to be revoked
98+
AKI string `json:"aki,omitempty" opt:"a" help:"AKI (Authority Key Identifier) of the certificate to be revoked"`
99+
// Reason is the reason for revocation. See https://godoc.org/golang.org/x/crypto/ocsp for
100+
// valid values. The default value is 0 (ocsp.Unspecified).
101+
Reason string `json:"reason,omitempty" opt:"r" help:"Reason for revocation"`
102+
// CAName is the name of the CA to connect to
103+
CAName string `json:"caname,omitempty" skip:"true"`
104+
}
105+
106+
// GetTCertBatchRequest is input provided to identity.GetTCertBatch
107+
type GetTCertBatchRequest struct {
108+
// Number of TCerts in the batch.
109+
Count int `json:"count"`
110+
// The attribute names whose names and values are to be sealed in the issued TCerts.
111+
AttrNames []string `json:"attr_names,omitempty"`
112+
// EncryptAttrs denotes whether to encrypt attribute values or not.
113+
// When set to true, each issued TCert in the batch will contain encrypted attribute values.
114+
EncryptAttrs bool `json:"encrypt_attrs,omitempty"`
115+
// Certificate Validity Period. If specified, the value used
116+
// is the minimum of this value and the configured validity period
117+
// of the TCert manager.
118+
ValidityPeriod time.Duration `json:"validity_period,omitempty"`
119+
// The pre-key to be used for key derivation.
120+
PreKey string `json:"prekey"`
121+
// DisableKeyDerivation if true disables key derivation so that a TCert is not
122+
// cryptographically related to an ECert. This may be necessary when using an
123+
// HSM which does not support the TCert's key derivation function.
124+
DisableKeyDerivation bool `json:"disable_kdf,omitempty"`
125+
// CAName is the name of the CA to connect to
126+
CAName string `json:"caname,omitempty" skip:"true"`
127+
}
128+
129+
// GetTCertBatchResponse is the return value of identity.GetTCertBatch
130+
type GetTCertBatchResponse struct {
131+
tcert.GetBatchResponse
132+
}
133+
134+
// GetCAInfoRequest is request to get generic CA information
135+
type GetCAInfoRequest struct {
136+
CAName string `json:"caname,omitempty" skip:"true"`
137+
}
138+
139+
// CSRInfo is Certificate Signing Request information
140+
type CSRInfo struct {
141+
CN string `json:"CN"`
142+
Names []csr.Name `json:"names,omitempty"`
143+
Hosts []string `json:"hosts,omitempty"`
144+
KeyRequest *csr.BasicKeyRequest `json:"key,omitempty"`
145+
CA *csr.CAConfig `json:"ca,omitempty"`
146+
SerialNumber string `json:"serial_number,omitempty"`
147+
}
148+
149+
// Attribute is a name and value pair
150+
type Attribute struct {
151+
Name string `json:"name"`
152+
Value string `json:"value"`
153+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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-sdk-go/internal/github.com/hyperledger/fabric-ca/lib/tcert"
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+
}
45+
46+
// ReenrollmentRequestNet is a request to reenroll an identity.
47+
// This is useful to renew a certificate before it has expired.
48+
type ReenrollmentRequestNet struct {
49+
signer.SignRequest
50+
CAName string
51+
}
52+
53+
// RevocationRequestNet is a revocation request which flows over the network
54+
// to the fabric-ca server.
55+
// To revoke a single certificate, both the Serial and AKI fields must be set;
56+
// otherwise, to revoke all certificates and the identity associated with an enrollment ID,
57+
// the Name field must be set to an existing enrollment ID.
58+
// A RevocationRequest can only be performed by a user with the "hf.Revoker" attribute.
59+
type RevocationRequestNet struct {
60+
RevocationRequest
61+
}
62+
63+
// GetTCertBatchRequestNet is a network request for a batch of transaction certificates
64+
type GetTCertBatchRequestNet struct {
65+
GetTCertBatchRequest
66+
// KeySigs is an optional array of public keys and corresponding signatures.
67+
// If not set, the server generates it's own keys based on a key derivation function
68+
// which cryptographically relates the TCerts to an ECert.
69+
KeySigs []KeySig `json:"key_sigs,omitempty"`
70+
}
71+
72+
// GetTCertBatchResponseNet is the network response for a batch of transaction certificates
73+
type GetTCertBatchResponseNet struct {
74+
tcert.GetBatchResponse
75+
}
76+
77+
// KeySig is a public key, signature, and signature algorithm tuple
78+
type KeySig struct {
79+
// Key is a public key
80+
Key []byte `json:"key"`
81+
// Sig is a signature over the PublicKey
82+
Sig []byte `json:"sig"`
83+
// Alg is the signature algorithm
84+
Alg string `json:"alg"`
85+
}

0 commit comments

Comments
 (0)