2019-02-07 09:04:29 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package pkcrypto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2019-02-07 18:40:28 +00:00
|
|
|
// BlockLabelEcPrivateKey is the value to define a block label of EC private key
|
|
|
|
// (which is used here only for backwards compatibility). Use a general PKCS#8
|
|
|
|
// encoding instead.
|
|
|
|
BlockLabelEcPrivateKey = "EC PRIVATE KEY"
|
|
|
|
// BlockLabelPrivateKey is the value to define a block label of general private key
|
|
|
|
// (used for PKCS#8-encoded private keys of type RSA, ECDSA, and others).
|
|
|
|
BlockLabelPrivateKey = "PRIVATE KEY"
|
|
|
|
// BlockLabelPublicKey is the value to define a block label of general public key
|
|
|
|
// (used for PKIX-encoded public keys of type RSA, ECDSA, and others).
|
|
|
|
BlockLabelPublicKey = "PUBLIC KEY"
|
|
|
|
// BlockLabelCertificate is the value to define a block label of certificates
|
|
|
|
BlockLabelCertificate = "CERTIFICATE"
|
|
|
|
// BlockLabelExtension is the value to define a block label of certificate extensions
|
|
|
|
BlockLabelExtension = "EXTENSION"
|
2019-02-07 09:04:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrUnsupportedKey is used when key type is not supported.
|
|
|
|
ErrUnsupportedKey = errs.Class("unsupported key type")
|
2019-02-07 20:39:20 +00:00
|
|
|
// ErrParse is used when an error occurs while parsing a certificate or key.
|
|
|
|
ErrParse = errs.Class("unable to parse")
|
2019-02-07 09:04:29 +00:00
|
|
|
// ErrSign is used when something goes wrong while generating a signature.
|
|
|
|
ErrSign = errs.Class("unable to generate signature")
|
2019-02-07 20:39:20 +00:00
|
|
|
// ErrVerifySignature is used when a signature verification error occurs.
|
|
|
|
ErrVerifySignature = errs.Class("signature verification error")
|
2019-02-07 18:40:28 +00:00
|
|
|
// ErrChainLength is used when the length of a cert chain isn't what was expected
|
|
|
|
ErrChainLength = errs.Class("cert chain length error")
|
2019-02-07 09:04:29 +00:00
|
|
|
)
|