Documentation
¶
Overview ¶
Package testpki creates ephemeral certificate authorities and identities for tests and the device simulator.
Design ¶
Shared fixtures provide device signing identities, TLS server certificates and APNs-topic certificates with consistent chain structure. Keys are generated at test time and validity is short. These helpers do not apply production issuance policy and their roots must not be trusted outside tests. Production signing uses pki/ca with configured keys, policy and storage.
References ¶
- End-to-end scenarios: https://github.com/deploymenttheory/go-apple-dm/blob/main/docs/testing/e2e-scenarios.md
- Apple: https://developer.apple.com/documentation/devicemanagement/managing-certificates-for-device-management-services-and-devices
- Apple: https://developer.apple.com/documentation/devicemanagement/setting-up-push-notifications-for-your-device-management-customers
Index ¶
- Variables
- type CA
- func (ca *CA) Issue(commonName string, notBefore time.Time) (*Identity, error)
- func (ca *CA) IssueApp(topic string, notBefore time.Time) (*Identity, error)
- func (ca *CA) IssuePush(topic string, notBefore time.Time) (*Identity, error)
- func (ca *CA) IssuePushWithKey(topic string, notBefore time.Time, key crypto.Signer) (*Identity, error)
- func (ca *CA) IssueWithKey(commonName string, notBefore time.Time, key crypto.Signer) (*Identity, error)
- func (ca *CA) Pool() *x509.CertPool
- type Identity
Constants ¶
This section is empty.
Variables ¶
var ErrNilKey = errors.New("testpki: nil key")
ErrNilKey is returned when no key is supplied.
Functions ¶
This section is empty.
Types ¶
type CA ¶
type CA struct {
Identity
// contains filtered or unexported fields
}
CA is a test certificate authority.
func (*CA) Issue ¶
Issue signs a device identity (ECDSA P-256) with the given common name, valid from notBefore for one day.
func (*CA) IssueApp ¶ added in v0.3.0
IssueApp signs a provider identity whose Apple topic extension authorizes ordinary app notifications. It does not authorize MDM pushes.
func (*CA) IssuePush ¶
IssuePush signs an APNs push certificate (RSA 2048, like the ones Apple issues) whose subject UID carries topic, valid from notBefore for one day.
func (*CA) IssuePushWithKey ¶
func (ca *CA) IssuePushWithKey( topic string, notBefore time.Time, key crypto.Signer, ) (*Identity, error)
IssuePushWithKey signs an APNs push certificate for an existing key with the subject UID set to topic.