camlistore.org: camlistore.org/pkg/jsonsign Index | Files | Directories

package jsonsign

import "camlistore.org/pkg/jsonsign"

Package jsonsign implements Camlistore's cryptographic signing and verification of JSON blobs.

Index

Package Files

doc.go keys.go sign.go sign_normal.go verify.go

func ArmoredPublicKey Uses

func ArmoredPublicKey(entity *openpgp.Entity) (string, error)

func EntityFromSecring Uses

func EntityFromSecring(keyId, keyFile string) (*openpgp.Entity, error)

EntityFromSecring returns the openpgp Entity from keyFile that matches keyId. If empty, keyFile defaults to osutil.SecretRingFile().

func GenerateNewSecRing Uses

func GenerateNewSecRing(secRing string) (keyId string, err error)

GenerateNewSecRing creates a new secret ring file secRing, with a new GPG identity. It returns the public keyId of that identity. It returns an error if the file already exists.

func KeyIdFromRing Uses

func KeyIdFromRing(secRing string) (keyId string, err error)

KeyIdFromRing returns the public keyId contained in the secret ring file secRing. It expects only one keyId in this secret ring and returns an error otherwise.

func NewEntity Uses

func NewEntity() (*openpgp.Entity, error)

NewEntity returns a new OpenPGP entity.

func ParseArmoredPublicKey Uses

func ParseArmoredPublicKey(r io.Reader) (shortKeyId, armoredKey string, err error)

ParseArmoredPublicKey tries to parse an armored public key from r, taking care to bound the amount it reads. The returned shortKeyId is 8 capital hex digits. The returned armoredKey is a copy of the contents read.

func VerifyPublicKeyFile Uses

func VerifyPublicKeyFile(file, keyid string) (bool, error)

func WriteKeyRing Uses

func WriteKeyRing(w io.Writer, el openpgp.EntityList) error

type CachingEntityFetcher Uses

type CachingEntityFetcher struct {
    Fetcher EntityFetcher
    // contains filtered or unexported fields
}

func (*CachingEntityFetcher) FetchEntity Uses

func (ce *CachingEntityFetcher) FetchEntity(keyId string) (*openpgp.Entity, error)

type EntityFetcher Uses

type EntityFetcher interface {
    FetchEntity(keyId string) (*openpgp.Entity, error)
}

type FileEntityFetcher Uses

type FileEntityFetcher struct {
    File string
}

func FlagEntityFetcher Uses

func FlagEntityFetcher() *FileEntityFetcher

func (*FileEntityFetcher) FetchEntity Uses

func (fe *FileEntityFetcher) FetchEntity(keyId string) (*openpgp.Entity, error)

type SignRequest Uses

type SignRequest struct {
    UnsignedJSON string
    Fetcher      blob.Fetcher
    ServerMode   bool // if true, can't use pinentry or gpg-agent, etc.

    // Optional signature time. If zero, time.Now() is used.
    SignatureTime time.Time

    // Optional function to return an entity (including decrypting
    // the PrivateKey, if necessary)
    EntityFetcher EntityFetcher

    // SecretKeyringPath is only used if EntityFetcher is nil,
    // in which case SecretKeyringPath is used if non-empty.
    // As a final resort, we default to osutil.SecretRingFile().
    SecretKeyringPath string
}

func (*SignRequest) Sign Uses

func (sr *SignRequest) Sign() (signedJSON string, err error)

type VerifyRequest Uses

type VerifyRequest struct {
    CamliSigner     blob.Ref
    CamliSig        string
    PublicKeyPacket *packet.PublicKey

    // set if Verify() returns true:
    PayloadMap  map[string]interface{} // The JSON values from BPJ
    SignerKeyId string                 // e.g. "2931A67C26F5ABDA"

    Err error // last error encountered
    // contains filtered or unexported fields
}

See doc/json-signing/* for background and details on these variable names.

func NewVerificationRequest Uses

func NewVerificationRequest(sjson string, fetcher blob.Fetcher) (vr *VerifyRequest)

func (*VerifyRequest) FindAndParsePublicKeyBlob Uses

func (vr *VerifyRequest) FindAndParsePublicKeyBlob() bool

func (*VerifyRequest) ParsePayloadMap Uses

func (vr *VerifyRequest) ParsePayloadMap() bool

func (*VerifyRequest) ParseSigMap Uses

func (vr *VerifyRequest) ParseSigMap() bool

func (*VerifyRequest) Verify Uses

func (vr *VerifyRequest) Verify() bool

TODO: turn this into (bool, os.Error) return, probably, or *Details, os.Error.

func (*VerifyRequest) VerifySignature Uses

func (vr *VerifyRequest) VerifySignature() bool

Directories

PathSynopsis
signhandlerPackage signhandler implements the HTTP interface to signing and verifying Camlistore JSON blobs.

Package jsonsign imports 23 packages (graph) and is imported by 242 packages. Updated 2018-01-25. Refresh now. Tools for package owners.