1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // This file is run by the x509 tests to ensure that a program with minimal
8 // imports can sign certificates without errors resulting from missing hash
22 block
, _
:= pem
.Decode([]byte(pemPrivateKey
))
23 rsaPriv
, err
:= x509
.ParsePKCS1PrivateKey(block
.Bytes
)
25 panic("Failed to parse private key: " + err
.Error())
28 template
:= x509
.Certificate
{
29 SerialNumber
: big
.NewInt(1),
32 Organization
: []string{"Σ Acme Co"},
34 NotBefore
: time
.Unix(1000, 0),
35 NotAfter
: time
.Unix(100000, 0),
36 KeyUsage
: x509
.KeyUsageCertSign
,
39 if _
, err
= x509
.CreateCertificate(rand
.Reader
, &template
, &template
, &rsaPriv
.PublicKey
, rsaPriv
); err
!= nil {
40 panic("failed to create certificate with basic imports: " + err
.Error())
44 var pemPrivateKey
= `-----BEGIN RSA PRIVATE KEY-----
45 MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0
46 fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu
47 /ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu
48 RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/
49 EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A
50 IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS
51 tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V
52 -----END RSA PRIVATE KEY-----