diff options
| author | Jeremy Clerc <jclerc@google.com> | 2017-02-11 00:13:54 +0100 |
|---|---|---|
| committer | Jeremy Clerc <jclerc@google.com> | 2017-02-12 23:54:16 +0100 |
| commit | 06ee1171dee17245e71bb0ddd742c7f95f9bd2cb (patch) | |
| tree | 64767087217188af49e4c3788188ce6568198fa7 /pkg/store/store.go | |
| parent | c42a84ae556034b9fe2f9710603b1c10e8c5588f (diff) | |
| download | easypki-06ee1171dee17245e71bb0ddd742c7f95f9bd2cb.tar.xz | |
Refactor the all API for cleanup and extensibility.v1.0.0
API now has a store interface so one could choose to store the different
files in a database for example.
Diffstat (limited to 'pkg/store/store.go')
| -rw-r--r-- | pkg/store/store.go | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/pkg/store/store.go b/pkg/store/store.go new file mode 100644 index 0000000..2b311d9 --- /dev/null +++ b/pkg/store/store.go @@ -0,0 +1,65 @@ +// Copyright 2015 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package store provides different methods to store a Public Key Infrastructure. +package store + +import ( + "crypto/x509/pkix" + "math/big" + + "github.com/google/easypki/pkg/certificate" +) + +// Store reprents a way to store a Certificate Authority. +type Store interface { + // Add adds a newly signed certificate bundle to the store. + // + // Args: + // The CA name, if the certificate was signed with an intermediate CA. + // The certificate bundle name. + // Is the bundle to add an intermediate CA. + // The raw private key. + // The raw certificate. + // + // Returns an error if it failed to store the bundle. + Add(string, string, bool, []byte, []byte) error + + // Fetch fetches a certificate bundle from the store. + // + // Args: + // The CA name, if the certificate was signed with an intermediate CA. + // The name of the certificate bundle. + // + // Returns the raw private key and certificate respectively or an error. + Fetch(string, string) ([]byte, []byte, error) + + // Update updates the state of a certificate. (Valid, Revoked, Expired) + // + // Args: + // The CA name, if the certificate was signed with an intermediate CA. + // The serial of the certificate to update. + // The new state. + // + // Returns an error if the update failed. + Update(string, *big.Int, certificate.State) error + + // Revoked returns a list of revoked certificates for a given CA. + // + // Args: + // The CA name, if it is for an intermediate CA. + // + // Returns a list of revoked certificate or an error. + Revoked(string) ([]pkix.RevokedCertificate, error) +} |
