Documentation
¶
Overview ¶
Package signctx carries a context.Context to a signer or decrypter that can use one, for packages below cryptoprov in the import graph (certutil). cryptoprov.ContextSigner, ContextDecrypter, SignContext, DecryptContext and BindContext are the public form; an implementation satisfies both, since the interfaces have the same method sets.
signer = signctx.Bind(ctx, signer) der, err := x509.CreateCertificate(rand.Reader, template, parent, pub, signer)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind returns a crypto.Signer whose Sign is Sign(ctx, signer, ...), for an API that only calls Sign, such as x509.CreateCertificate: a Signer signs through SignContext with ctx, any other signer through Sign once ctx is checked. The bound signer has Public and Sign, and SignMessage when signer is a crypto.MessageSigner but not a Signer: SignMessage takes no context, so a Signer is bound without it and crypto.SignMessage signs through the bound Sign. It hides every other method and the concrete type of signer, so bind at the call and keep signer for type checks. It must not outlive ctx.
func Decrypt ¶
func Decrypt(ctx context.Context, decrypter crypto.Decrypter, rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) ([]byte, error)
Decrypt decrypts ciphertext with decrypter under ctx: through DecryptContext when decrypter is a Decrypter, otherwise through Decrypt once ctx is checked.
func Sign ¶
func Sign(ctx context.Context, signer crypto.Signer, rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
Sign signs digest with signer under ctx: through SignContext when signer is a Signer, otherwise through Sign once ctx is checked, since a plain signer cannot be interrupted.