Skip to content

Commit d30a952

Browse files
committed
Use always go.step.sm/crypto
1 parent 533ad0c commit d30a952

40 files changed

+70
-60
lines changed

acme/api/handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"github.com/smallstep/certificates/acme"
2020
"github.com/smallstep/certificates/authority/provisioner"
2121
"github.com/smallstep/certificates/db"
22-
"github.com/smallstep/cli/crypto/pemutil"
2322
"github.com/smallstep/cli/jose"
23+
"go.step.sm/crypto/pemutil"
2424
)
2525

2626
type mockAcmeAuthority struct {

acme/api/middleware.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"github.com/smallstep/certificates/api"
1515
"github.com/smallstep/certificates/authority/provisioner"
1616
"github.com/smallstep/certificates/logging"
17-
"github.com/smallstep/cli/crypto/keys"
1817
"github.com/smallstep/cli/jose"
1918
"github.com/smallstep/nosql"
19+
"go.step.sm/crypto/keyutil"
2020
)
2121

2222
type nextHTTP = func(http.ResponseWriter, *http.Request)
@@ -173,10 +173,10 @@ func (h *Handler) validateJWS(next nextHTTP) nextHTTP {
173173
if hdr.JSONWebKey != nil {
174174
switch k := hdr.JSONWebKey.Key.(type) {
175175
case *rsa.PublicKey:
176-
if k.Size() < keys.MinRSAKeyBytes {
176+
if k.Size() < keyutil.MinRSAKeyBytes {
177177
api.WriteError(w, acme.MalformedErr(errors.Errorf("rsa "+
178178
"keys must be at least %d bits (%d bytes) in size",
179-
8*keys.MinRSAKeyBytes, keys.MinRSAKeyBytes)))
179+
8*keyutil.MinRSAKeyBytes, keyutil.MinRSAKeyBytes)))
180180
return
181181
}
182182
default:

acme/api/order_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/pkg/errors"
1818
"github.com/smallstep/assert"
1919
"github.com/smallstep/certificates/acme"
20-
"github.com/smallstep/cli/crypto/pemutil"
20+
"go.step.sm/crypto/pemutil"
2121
)
2222

2323
func TestNewOrderRequestValidate(t *testing.T) {

acme/certificate_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"github.com/pkg/errors"
1111
"github.com/smallstep/assert"
1212
"github.com/smallstep/certificates/db"
13-
"github.com/smallstep/cli/crypto/pemutil"
1413
"github.com/smallstep/nosql"
1514
"github.com/smallstep/nosql/database"
15+
"go.step.sm/crypto/pemutil"
1616
)
1717

1818
func defaultCertOps() (*CertOptions, error) {

authority/authority.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/smallstep/certificates/kms"
1717
kmsapi "github.com/smallstep/certificates/kms/apiv1"
1818
"github.com/smallstep/certificates/templates"
19-
"github.com/smallstep/cli/crypto/pemutil"
19+
"go.step.sm/crypto/pemutil"
2020
"golang.org/x/crypto/ssh"
2121
)
2222

authority/authority_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
"github.com/smallstep/assert"
1616
"github.com/smallstep/certificates/authority/provisioner"
1717
"github.com/smallstep/certificates/db"
18-
"github.com/smallstep/cli/crypto/pemutil"
1918
stepJOSE "github.com/smallstep/cli/jose"
19+
"go.step.sm/crypto/pemutil"
2020
)
2121

2222
func testAuthority(t *testing.T, opts ...Option) *Authority {

authority/authorize_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"github.com/smallstep/certificates/authority/provisioner"
1818
"github.com/smallstep/certificates/db"
1919
"github.com/smallstep/certificates/errs"
20-
"github.com/smallstep/cli/crypto/pemutil"
2120
"github.com/smallstep/cli/jose"
21+
"go.step.sm/crypto/pemutil"
2222
"go.step.sm/crypto/randutil"
2323
"golang.org/x/crypto/ssh"
2424
"gopkg.in/square/go-jose.v2/jwt"

authority/provisioner/k8sSA.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111

1212
"github.com/pkg/errors"
1313
"github.com/smallstep/certificates/errs"
14-
"github.com/smallstep/cli/crypto/pemutil"
1514
"github.com/smallstep/cli/jose"
15+
"go.step.sm/crypto/pemutil"
1616
"go.step.sm/crypto/sshutil"
1717
"go.step.sm/crypto/x509util"
1818
)

authority/provisioner/options_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"reflect"
88
"testing"
99

10-
"github.com/smallstep/cli/crypto/pemutil"
10+
"go.step.sm/crypto/pemutil"
1111
"go.step.sm/crypto/x509util"
1212
)
1313

authority/provisioner/sign_options_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/pkg/errors"
1414
"github.com/smallstep/assert"
15-
"github.com/smallstep/cli/crypto/pemutil"
15+
"go.step.sm/crypto/pemutil"
1616
)
1717

1818
func Test_emailOnlyIdentity_Valid(t *testing.T) {

authority/provisioner/sign_ssh_options.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99

1010
"github.com/pkg/errors"
11-
"github.com/smallstep/cli/crypto/keys"
11+
"go.step.sm/crypto/keyutil"
1212
"golang.org/x/crypto/ssh"
1313
)
1414

@@ -423,9 +423,9 @@ func (v sshDefaultPublicKeyValidator) Valid(cert *ssh.Certificate, o SignSSHOpti
423423
if err != nil {
424424
return err
425425
}
426-
if key.Size() < keys.MinRSAKeyBytes {
426+
if key.Size() < keyutil.MinRSAKeyBytes {
427427
return errors.Errorf("ssh certificate key must be at least %d bits (%d bytes)",
428-
8*keys.MinRSAKeyBytes, keys.MinRSAKeyBytes)
428+
8*keyutil.MinRSAKeyBytes, keyutil.MinRSAKeyBytes)
429429
}
430430
return nil
431431
case ssh.KeyAlgoDSA:

authority/provisioner/sign_ssh_options_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/pkg/errors"
99
"github.com/smallstep/assert"
10-
"github.com/smallstep/cli/crypto/keys"
10+
"go.step.sm/crypto/keyutil"
1111
"golang.org/x/crypto/ssh"
1212
)
1313

@@ -489,7 +489,7 @@ func Test_sshDefaultExtensionModifier_Modify(t *testing.T) {
489489
}
490490

491491
func Test_sshCertDefaultValidator_Valid(t *testing.T) {
492-
pub, _, err := keys.GenerateDefaultKeyPair()
492+
pub, _, err := keyutil.GenerateDefaultKeyPair()
493493
assert.FatalError(t, err)
494494
sshPub, err := ssh.NewPublicKey(pub)
495495
assert.FatalError(t, err)

authority/provisioner/sshpop_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"github.com/smallstep/assert"
1414
"github.com/smallstep/certificates/db"
1515
"github.com/smallstep/certificates/errs"
16-
"github.com/smallstep/cli/crypto/pemutil"
1716
"github.com/smallstep/cli/jose"
17+
"go.step.sm/crypto/pemutil"
1818
"golang.org/x/crypto/ssh"
1919
)
2020

authority/provisioner/utils_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"time"
1717

1818
"github.com/pkg/errors"
19-
"github.com/smallstep/cli/crypto/pemutil"
2019
"github.com/smallstep/cli/jose"
20+
"go.step.sm/crypto/pemutil"
2121
"go.step.sm/crypto/randutil"
2222
"golang.org/x/crypto/ssh"
2323
)

authority/provisioner/x5c_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/pkg/errors"
1010
"github.com/smallstep/assert"
1111
"github.com/smallstep/certificates/errs"
12-
"github.com/smallstep/cli/crypto/pemutil"
1312
"github.com/smallstep/cli/jose"
13+
"go.step.sm/crypto/pemutil"
1414
"go.step.sm/crypto/randutil"
1515
)
1616

authority/root_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/pkg/errors"
1010
"github.com/smallstep/assert"
1111
"github.com/smallstep/certificates/errs"
12-
"github.com/smallstep/cli/crypto/pemutil"
12+
"go.step.sm/crypto/pemutil"
1313
)
1414

1515
func TestRoot(t *testing.T) {

authority/tls.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
"github.com/smallstep/certificates/authority/provisioner"
1616
"github.com/smallstep/certificates/db"
1717
"github.com/smallstep/certificates/errs"
18-
"github.com/smallstep/cli/crypto/keys"
19-
"github.com/smallstep/cli/crypto/pemutil"
2018
"github.com/smallstep/cli/jose"
19+
"go.step.sm/crypto/keyutil"
20+
"go.step.sm/crypto/pemutil"
2121
"go.step.sm/crypto/x509util"
2222
)
2323

@@ -363,7 +363,7 @@ func (a *Authority) GetTLSCertificate() (*tls.Certificate, error) {
363363
}
364364

365365
// Generate default key.
366-
priv, err := keys.GenerateDefaultKey()
366+
priv, err := keyutil.GenerateDefaultKey()
367367
if err != nil {
368368
return fatal(err)
369369
}

authority/tls_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"github.com/smallstep/certificates/authority/provisioner"
2323
"github.com/smallstep/certificates/db"
2424
"github.com/smallstep/certificates/errs"
25-
"github.com/smallstep/cli/crypto/keys"
26-
"github.com/smallstep/cli/crypto/pemutil"
2725
"github.com/smallstep/cli/jose"
26+
"go.step.sm/crypto/keyutil"
27+
"go.step.sm/crypto/pemutil"
2828
"go.step.sm/crypto/x509util"
2929
"gopkg.in/square/go-jose.v2/jwt"
3030
)
@@ -196,7 +196,7 @@ type basicConstraints struct {
196196
}
197197

198198
func TestAuthority_Sign(t *testing.T) {
199-
pub, priv, err := keys.GenerateDefaultKeyPair()
199+
pub, priv, err := keyutil.GenerateDefaultKeyPair()
200200
assert.FatalError(t, err)
201201

202202
a := testAuthority(t)
@@ -745,7 +745,7 @@ func TestAuthority_Renew(t *testing.T) {
745745
}
746746

747747
func TestAuthority_Rekey(t *testing.T) {
748-
pub, _, err := keys.GenerateDefaultKeyPair()
748+
pub, _, err := keyutil.GenerateDefaultKeyPair()
749749
assert.FatalError(t, err)
750750

751751
a := testAuthority(t)

ca/acmeClient_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"github.com/smallstep/certificates/acme"
1717
acmeAPI "github.com/smallstep/certificates/acme/api"
1818
"github.com/smallstep/certificates/api"
19-
"github.com/smallstep/cli/crypto/pemutil"
2019
"github.com/smallstep/cli/jose"
20+
"go.step.sm/crypto/pemutil"
2121
)
2222

2323
func TestNewACMEClient(t *testing.T) {

ca/ca_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import (
2525
"github.com/smallstep/certificates/authority"
2626
"github.com/smallstep/certificates/authority/provisioner"
2727
"github.com/smallstep/certificates/errs"
28-
"github.com/smallstep/cli/crypto/keys"
29-
"github.com/smallstep/cli/crypto/pemutil"
3028
stepJOSE "github.com/smallstep/cli/jose"
29+
"go.step.sm/crypto/keyutil"
30+
"go.step.sm/crypto/pemutil"
3131
"go.step.sm/crypto/randutil"
3232
"go.step.sm/crypto/x509util"
3333
jose "gopkg.in/square/go-jose.v2"
@@ -76,7 +76,7 @@ func TestMain(m *testing.M) {
7676
}
7777

7878
func TestCASign(t *testing.T) {
79-
pub, priv, err := keys.GenerateDefaultKeyPair()
79+
pub, priv, err := keyutil.GenerateDefaultKeyPair()
8080
assert.FatalError(t, err)
8181

8282
asn1dn := &authority.ASN1DN{
@@ -551,7 +551,7 @@ func TestCAHealth(t *testing.T) {
551551
}
552552

553553
func TestCARenew(t *testing.T) {
554-
pub, priv, err := keys.GenerateDefaultKeyPair()
554+
pub, priv, err := keyutil.GenerateDefaultKeyPair()
555555
assert.FatalError(t, err)
556556

557557
asn1dn := &authority.ASN1DN{

ca/client.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
"github.com/smallstep/certificates/ca/identity"
2929
"github.com/smallstep/certificates/errs"
3030
"github.com/smallstep/cli/config"
31-
"github.com/smallstep/cli/crypto/keys"
32-
"github.com/smallstep/cli/crypto/pemutil"
31+
"go.step.sm/crypto/keyutil"
32+
"go.step.sm/crypto/pemutil"
3333
"go.step.sm/crypto/x509util"
3434
"golang.org/x/net/http2"
3535
"gopkg.in/square/go-jose.v2/jwt"
@@ -1102,7 +1102,7 @@ func CreateSignRequest(ott string) (*api.SignRequest, crypto.PrivateKey, error)
11021102
// CreateCertificateRequest creates a new CSR with the given common name and
11031103
// SANs. If no san is provided the commonName will set also a SAN.
11041104
func CreateCertificateRequest(commonName string, sans ...string) (*api.CertificateRequest, crypto.PrivateKey, error) {
1105-
key, err := keys.GenerateDefaultKey()
1105+
key, err := keyutil.GenerateDefaultKey()
11061106
if err != nil {
11071107
return nil, nil, err
11081108
}

ca/identity/identity.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/pkg/errors"
1818
"github.com/smallstep/certificates/api"
1919
"github.com/smallstep/cli/config"
20-
"github.com/smallstep/cli/crypto/pemutil"
20+
"go.step.sm/crypto/pemutil"
2121
)
2222

2323
// Type represents the different types of identity files.

ca/identity/identity_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"testing"
1414

1515
"github.com/smallstep/certificates/api"
16-
"github.com/smallstep/cli/crypto/pemutil"
16+
"go.step.sm/crypto/pemutil"
1717
)
1818

1919
func TestLoadDefaultIdentity(t *testing.T) {

ca/provisioner_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/smallstep/cli/crypto/pemutil"
1110
"github.com/smallstep/cli/jose"
11+
"go.step.sm/crypto/pemutil"
1212
"go.step.sm/crypto/x509util"
1313
)
1414

cmd/step-awskms-init/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616

1717
"github.com/smallstep/certificates/kms/apiv1"
1818
"github.com/smallstep/certificates/kms/awskms"
19-
"github.com/smallstep/cli/crypto/pemutil"
2019
"github.com/smallstep/cli/ui"
2120
"github.com/smallstep/cli/utils"
21+
"go.step.sm/crypto/pemutil"
2222
"golang.org/x/crypto/ssh"
2323
)
2424

cmd/step-cloudkms-init/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717

1818
"github.com/smallstep/certificates/kms/apiv1"
1919
"github.com/smallstep/certificates/kms/cloudkms"
20-
"github.com/smallstep/cli/crypto/pemutil"
2120
"github.com/smallstep/cli/ui"
2221
"github.com/smallstep/cli/utils"
22+
"go.step.sm/crypto/pemutil"
2323
"golang.org/x/crypto/ssh"
2424
)
2525

cmd/step-yubikey-init/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
"github.com/pkg/errors"
2020
"github.com/smallstep/certificates/kms"
2121
"github.com/smallstep/certificates/kms/apiv1"
22-
"github.com/smallstep/cli/crypto/pemutil"
2322
"github.com/smallstep/cli/ui"
2423
"github.com/smallstep/cli/utils"
24+
"go.step.sm/crypto/pemutil"
2525

2626
// Enable yubikey.
2727
_ "github.com/smallstep/certificates/kms/yubikey"

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/smallstep/nosql v0.3.0
1919
github.com/urfave/cli v1.22.2
2020
go.step.sm/crypto v0.1.1
21-
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904
21+
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
2222
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
2323
google.golang.org/api v0.15.0
2424
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb
@@ -28,4 +28,4 @@ require (
2828

2929
// replace github.com/smallstep/cli => ../cli
3030
// replace github.com/smallstep/nosql => ../nosql
31-
// replace go.step.sm/crypto => ../crypto
31+
replace go.step.sm/crypto => ../crypto

go.sum

+3
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ github.com/smallstep/assert v0.0.0-20200103212524-b99dc1097b15/go.mod h1:MyOHs9P
479479
github.com/smallstep/certificates v0.14.5/go.mod h1:zzpB8wMz967gL8FmK6zvCNB4pDVwFDKjPg1diTVc1h8=
480480
github.com/smallstep/certinfo v1.3.0/go.mod h1:1gQJekdPwPvUwFWGTi7bZELmQT09cxC9wJ0VBkBNiwU=
481481
github.com/smallstep/cli v0.14.5/go.mod h1:mRFuqC3cGwQESBGJvog4o76jZZZ7bMjkE+hAnq2QyR8=
482+
github.com/smallstep/cli v0.14.6 h1:xc9rawDKB70Vgvg10gfQAh9EpDWS3k1O002J5bApqUk=
482483
github.com/smallstep/cli v0.14.7-rc.1.0.20200721180458-731b7c4c8c95 h1:TcCYqEqh6EIEiFabRdtG0IGyFK01kRLTjx6TIKqjxX8=
483484
github.com/smallstep/cli v0.14.7-rc.1.0.20200721180458-731b7c4c8c95/go.mod h1:7aWHk7WwJMpEP4PYyav86FMpaI9vuA0uJRliUAqCwxg=
484485
github.com/smallstep/nosql v0.3.0 h1:V1X5vfDsDt89499h3jZFUlR4VnnsYYs5tXaQZ0w8z5U=
@@ -609,6 +610,8 @@ golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 h1:3zb4D3T4G8jdExgVU/95+v
609610
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
610611
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8=
611612
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
613+
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de h1:ikNHVSjEfnvz6sxdSPCaPt572qowuyMDMJLLm3Db3ig=
614+
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
612615
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
613616
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
614617
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=

0 commit comments

Comments
 (0)