Documentation
¶
Index ¶
- type Digest
- type DigestHashAlgorithm
- type DigestHeader
- type ECDSASignature
- type ED25519
- type ED25519PrivateKey
- type ED25519PublicKey
- type EcdsaSha256
- type EcdsaSha512
- type ErrCrypto
- type ErrDigest
- type ErrHS
- type ErrParser
- type ErrSecret
- type HTTPSignatures
- func (hs *HTTPSignatures) SetDefaultDigestAlgorithm(a string) error
- func (hs *HTTPSignatures) SetDefaultExpiresSeconds(e uint32)
- func (hs *HTTPSignatures) SetDefaultSignatureHeaders(h []string)
- func (hs *HTTPSignatures) SetDefaultTimeGap(t int64)
- func (hs *HTTPSignatures) SetDefaultVerifyDigest(v bool)
- func (hs *HTTPSignatures) SetDigestAlgorithm(a DigestHashAlgorithm)
- func (hs *HTTPSignatures) SetSignatureHashAlgorithm(a SignatureHashAlgorithm)
- func (hs *HTTPSignatures) Sign(secretKeyID string, r *http.Request) error
- func (hs *HTTPSignatures) Verify(r *http.Request) error
- type Headers
- type HmacSha256
- type HmacSha512
- type Md5
- type Parser
- type RsaSha256
- type RsaSha512
- type RsaSsaPssSha256
- type RsaSsaPssSha512
- type Secret
- type Secrets
- type Sha256
- type Sha512
- type SignatureHashAlgorithm
- type SimpleSecretsStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest digest internal struct
func (*Digest) SetDefaultDigestHashAlgorithm ¶
SetDefaultDigestHashAlgorithm set digest default algorithm options (default from available)
func (*Digest) SetDigestHashAlgorithm ¶
func (d *Digest) SetDigestHashAlgorithm(a DigestHashAlgorithm)
SetDigestHashAlgorithm set digest options (add new digest hash algorithm)
type DigestHashAlgorithm ¶
type DigestHashAlgorithm interface {
Algorithm() string
Create(data []byte) ([]byte, error)
Verify(data []byte, digest []byte) error
}
DigestHashAlgorithm interface to create/verify digest HMAC hash
type DigestHeader ¶
type DigestHeader struct {
// contains filtered or unexported fields
}
DigestHeader Digest header parsed into params (alg & digest)
type ED25519 ¶
type ED25519 struct{}
ED25519 ED25519 Algorithm
type ED25519PrivateKey ¶
type ED25519PrivateKey struct {
Version int
ObjectIdentifier struct {
ObjectIdentifier asn1.ObjectIdentifier
}
PrivateKey []byte
}
ED25519PrivateKey ED25519 PrivateKey
type ED25519PublicKey ¶
type ED25519PublicKey struct {
ObjectIdentifier struct {
ObjectIdentifier asn1.ObjectIdentifier
}
PublicKey asn1.BitString
}
ED25519PublicKey ED25519 PublicKey
type EcdsaSha256 ¶
type EcdsaSha256 struct{}
EcdsaSha256 ECDSA with SHA256 Algorithm
func (EcdsaSha256) Algorithm ¶
func (a EcdsaSha256) Algorithm() string
Algorithm Return algorithm name
type EcdsaSha512 ¶
type EcdsaSha512 struct{}
EcdsaSha512 ECDSA with SHA512 Algorithm
func (EcdsaSha512) Algorithm ¶
func (a EcdsaSha512) Algorithm() string
Algorithm Return algorithm name
type HTTPSignatures ¶
type HTTPSignatures struct {
// contains filtered or unexported fields
}
HTTPSignatures struct
func NewHTTPSignatures ¶
func NewHTTPSignatures(ss Secrets) *HTTPSignatures
NewHTTPSignatures Constructor
func (*HTTPSignatures) SetDefaultDigestAlgorithm ¶
func (hs *HTTPSignatures) SetDefaultDigestAlgorithm(a string) error
SetDefaultDigestAlgorithm set custom digest hash algorithm
func (*HTTPSignatures) SetDefaultExpiresSeconds ¶
func (hs *HTTPSignatures) SetDefaultExpiresSeconds(e uint32)
SetDefaultExpiresSeconds set default expires seconds (while creating signature). If signature never expires just exclude "expires" param from the headers list
func (*HTTPSignatures) SetDefaultSignatureHeaders ¶
func (hs *HTTPSignatures) SetDefaultSignatureHeaders(h []string)
SetDefaultSignatureHeaders set default list of headers to create signature (Sign method)
func (*HTTPSignatures) SetDefaultTimeGap ¶
func (hs *HTTPSignatures) SetDefaultTimeGap(t int64)
SetDefaultTimeGap set default time gap for (created)/(expires) validation
func (*HTTPSignatures) SetDefaultVerifyDigest ¶
func (hs *HTTPSignatures) SetDefaultVerifyDigest(v bool)
SetDefaultVerifyDigest set default verify digest or skip verification
func (*HTTPSignatures) SetDigestAlgorithm ¶
func (hs *HTTPSignatures) SetDigestAlgorithm(a DigestHashAlgorithm)
SetDigestAlgorithm set custom digest hash algorithm
func (*HTTPSignatures) SetSignatureHashAlgorithm ¶
func (hs *HTTPSignatures) SetSignatureHashAlgorithm(a SignatureHashAlgorithm)
SetSignatureHashAlgorithm set custom signature hash algorithm
type Headers ¶
type Headers struct {
KeyID string // REQUIRED
Algorithm string // RECOMMENDED
Created time.Time // RECOMMENDED
Expires time.Time // OPTIONAL (Not implemented: "Subsecond precision is allowed using decimal notation.")
Headers []string // OPTIONAL
Signature string // REQUIRED
}
Headers Signature headers & params
type HmacSha256 ¶
type HmacSha256 struct{}
HmacSha256 HMAC-SHA256 Algorithm
func (HmacSha256) Algorithm ¶
func (a HmacSha256) Algorithm() string
Algorithm Return algorithm name
type HmacSha512 ¶
type HmacSha512 struct{}
HmacSha512 HMAC-SHA512 Algorithm
func (HmacSha512) Algorithm ¶
func (a HmacSha512) Algorithm() string
Algorithm Return algorithm name
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parser internal struct
func (*Parser) ParseDigestHeader ¶
func (p *Parser) ParseDigestHeader(header string) (DigestHeader, *ErrParser)
ParseDigestHeader parse Digest header
func (*Parser) ParseSignatureHeader ¶
ParseSignatureHeader parse Signature header
func (*Parser) VerifySignatureFields ¶
VerifySignatureFields verify required fields
type RsaSha256 ¶
type RsaSha256 struct{}
RsaSha256 RSA-SHA265 Algorithm
type RsaSha512 ¶
type RsaSha512 struct{}
RsaSha512 RSA-SHA512 Algorithm
type RsaSsaPssSha256 ¶
type RsaSsaPssSha256 struct{}
RsaSsaPssSha256 RSA-PSS-SHA256 Algorithm
func (RsaSsaPssSha256) Algorithm ¶
func (a RsaSsaPssSha256) Algorithm() string
Algorithm Return algorithm name
type RsaSsaPssSha512 ¶
type RsaSsaPssSha512 struct{}
RsaSsaPssSha512 RSA-PSS-SHA512 Algorithm
func (RsaSsaPssSha512) Algorithm ¶
func (a RsaSsaPssSha512) Algorithm() string
Algorithm Return algorithm name
type Secrets ¶
Secrets interface to retrieve secrets from storage (local, DB, file etc)
func NewSimpleSecretsStorage ¶
NewSimpleSecretsStorage create new storage
type SignatureHashAlgorithm ¶
type SignatureHashAlgorithm interface {
Algorithm() string
Create(secret Secret, data []byte) ([]byte, error)
Verify(secret Secret, data []byte, signature []byte) error
}
SignatureHashAlgorithm interface to create/verify Signature using secret keys Algorithm return algorithm name Create create new signature Verify verify passed signature
type SimpleSecretsStorage ¶
type SimpleSecretsStorage struct {
// contains filtered or unexported fields
}
SimpleSecretsStorage local static secrets storage
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
digestHashAlgorithm
command
|
|
|
fileSecretsStorage
command
|
|
|
sign
command
|
|
|
signatureHashAlgorith
command
|
|
|
verify
command
|