Documentation ¶
Index ¶
- func PEMToPrivateKey(raw []byte, pwd []byte) (interface{}, error)
- func PullCrypto(manager *VaultManager, vaultPath string, keyname string) error
- func Reverse(s string) (result string)
- type CartridgeKey
- type CartridgeSigningIdentity
- type Manager
- type Option
- type SecretManager
- func (sm *SecretManager) Cache() cryptocache.CryptoCache
- func (sm *SecretManager) Sign(digest []byte, ecdsaPrivateKey *ecdsa.PrivateKey, ...) ([]byte, error)
- func (sm *SecretManager) SigningIdentity() CartridgeSigningIdentity
- func (sm *SecretManager) Verify(digest, signature []byte, ecdsaPublicKey *ecdsa.PublicKey) error
- type VaultIdentity
- func (m *VaultIdentity) EnrollmentCertificate() []byte
- func (m *VaultIdentity) Identifier() *msp.IdentityIdentifier
- func (m *VaultIdentity) ProtoMessage()
- func (m *VaultIdentity) Reset()
- func (m *VaultIdentity) Serialize() ([]byte, error)
- func (m *VaultIdentity) String() string
- func (m *VaultIdentity) Verify(msg []byte, sig []byte) error
- type VaultManager
- func (v *VaultManager) Cache() cryptocache.CryptoCache
- func (v *VaultManager) Sign(digest []byte, ecdsaPrivateKey *ecdsa.PrivateKey, ...) ([]byte, error)
- func (v *VaultManager) SigningIdentity() CartridgeSigningIdentity
- func (v *VaultManager) Verify(digest, signature []byte, ecdsaPublicKey *ecdsa.PublicKey) error
- type VaultSigningIdentity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PEMToPrivateKey ¶
PEMToPrivateKey converts a PEM encoded private key to a *ecdsa.PrivateKey
func PullCrypto ¶
func PullCrypto(manager *VaultManager, vaultPath string, keyname string) error
PullCrypto pulls crypto from Vault
Types ¶
type CartridgeKey ¶
type CartridgeKey struct { PrivKey *ecdsa.PrivateKey PubKey *ecdsa.PublicKey }
CartridgeKey is a core.Key wrapper for *ecdsa.PublicKey
func (*CartridgeKey) Bytes ¶
func (k *CartridgeKey) Bytes() (raw []byte, err error)
Bytes converts this key to its byte representation.
func (*CartridgeKey) Private ¶
func (k *CartridgeKey) Private() bool
Private returns true if this key is a private key, false otherwise.
func (*CartridgeKey) PublicKey ¶
func (k *CartridgeKey) PublicKey() (core.Key, error)
PublicKey returns the corresponding public key part of an asymmetric public/private key pair.
func (*CartridgeKey) SKI ¶
func (k *CartridgeKey) SKI() (ski []byte)
SKI returns the subject key identifier of this key.
func (*CartridgeKey) Symmetric ¶
func (k *CartridgeKey) Symmetric() bool
Symmetric returns true if this key is a symmetric key, false otherwise.
type CartridgeSigningIdentity ¶
type CartridgeSigningIdentity interface { Identifier() *msp.IdentityIdentifier Verify(msg []byte, sig []byte) error Serialize() ([]byte, error) EnrollmentCertificate() []byte Sign(msg []byte) ([]byte, error) PublicVersion() msp.Identity PrivateKey() core.Key }
CartridgeSigningIdentity is an interface that provides access to the signing identity
type Manager ¶
type Manager interface { Sign(digest []byte, ecdsaPrivateKey *ecdsa.PrivateKey, ecdsaPublicKey *ecdsa.PublicKey) ([]byte, error) Verify(digest, signature []byte, ecdsaPublicKey *ecdsa.PublicKey) error SigningIdentity() CartridgeSigningIdentity Cache() cryptocache.CryptoCache }
Manager is responsible for sign/verify operations.
type Option ¶
type Option func(c *VaultManager) error
Option is a function that configures a VaultManager
type SecretManager ¶
type SecretManager struct {
// contains filtered or unexported fields
}
SecretManager handles SecretManager operations
func NewSecretManager ¶
func NewSecretManager(mspID, project, userCert, credsPath string) (*SecretManager, error)
func (*SecretManager) Cache ¶
func (sm *SecretManager) Cache() cryptocache.CryptoCache
Cache returns cache
func (*SecretManager) Sign ¶
func (sm *SecretManager) Sign(digest []byte, ecdsaPrivateKey *ecdsa.PrivateKey, ecdsaPublicKey *ecdsa.PublicKey) ([]byte, error)
Sign signs digest using ecdsaPrivateKey
func (*SecretManager) SigningIdentity ¶
func (sm *SecretManager) SigningIdentity() CartridgeSigningIdentity
SigningIdentity returns signing identity
type VaultIdentity ¶
type VaultIdentity struct { MSPID string `protobuf:"bytes,1,opt,name=mspid,proto3" json:"mspid,omitempty"` IDBytes []byte `protobuf:"bytes,2,opt,name=idBytes,proto3" json:"idBytes,omitempty"` Manager Manager `json:"-"` Key *CartridgeKey `json:"-"` }
VaultIdentity is an interface that provides access to the identity
func (*VaultIdentity) EnrollmentCertificate ¶
func (m *VaultIdentity) EnrollmentCertificate() []byte
EnrollmentCertificate Returns the underlying ECert representing this user’s identity.
func (*VaultIdentity) Identifier ¶
func (m *VaultIdentity) Identifier() *msp.IdentityIdentifier
Identifier returns the identifier of that identity
func (*VaultIdentity) ProtoMessage ¶
func (m *VaultIdentity) ProtoMessage()
ProtoMessage indicates the identity is Protobuf serializable
func (*VaultIdentity) Serialize ¶
func (m *VaultIdentity) Serialize() ([]byte, error)
Serialize converts an identity to bytes
func (*VaultIdentity) String ¶
func (m *VaultIdentity) String() string
String converts struct to string reprezentation
type VaultManager ¶
type VaultManager struct {
// contains filtered or unexported fields
}
VaultManager handles VaultManager operations
func NewVaultManager ¶
func NewVaultManager(mspID, userCert, address, token, namespace string) (*VaultManager, error)
NewVaultManager gets new instance of VaultManager
func (*VaultManager) Cache ¶
func (v *VaultManager) Cache() cryptocache.CryptoCache
Cache returns the cache
func (*VaultManager) Sign ¶
func (v *VaultManager) Sign(digest []byte, ecdsaPrivateKey *ecdsa.PrivateKey, ecdsaPublicKey *ecdsa.PublicKey) ([]byte, error)
Sign signs the digest
func (*VaultManager) SigningIdentity ¶
func (v *VaultManager) SigningIdentity() CartridgeSigningIdentity
SigningIdentity returns the signing identity
type VaultSigningIdentity ¶
type VaultSigningIdentity struct {
*VaultIdentity
}
VaultSigningIdentity represents singing identity using Manager
func NewVaultSigningIdentity ¶
func NewVaultSigningIdentity(mspid, certname string, manager Manager) (*VaultSigningIdentity, error)
NewVaultSigningIdentity initializes VaultSigningIdentity
func (*VaultSigningIdentity) PrivateKey ¶
func (m *VaultSigningIdentity) PrivateKey() core.Key
PrivateKey returns the crypto suite representation of the private key
func (*VaultSigningIdentity) PublicVersion ¶
func (m *VaultSigningIdentity) PublicVersion() msp.Identity
PublicVersion returns the public parts of this identity