Versions in this module Expand all Collapse all v1 v1.6.1 Jul 9, 2019 Changes in this version + const AESGCMAuthTagSize + const AESGCMNonceSize + var SALT = []byte + func CreateRsaKey() (*rsa.PrivateKey, error) + func DeleteKeyringPassword(service string, user string) error + func EncodePrivate(password []byte, key crypto.PrivateKey) ([]byte, error) + func GenerateCACertificate(t *Template) (*x509.Certificate, error) + func GenerateServiceCertificate(t *Template) (*x509.Certificate, error) + func GetKeyringPassword(service string, user string, createIfNotExist bool) ([]byte, error) + func GetSignature(key *ecdsa.PrivateKey, data []byte) (string, error) + func KeyFromPassword(password []byte, l int) []byte + func LoadCertificate(file string) (*x509.Certificate, error) + func LoadPrivateKey(password []byte, file string) (crypto.PrivateKey, error) + func Md5(data []byte) []byte + func NewEcdsaPrivateKey(alg string) (*ecdsa.PrivateKey, error) + func NewLegacyAESGCMMaterials(info *encryption.NodeInfo) *legacyReadMaterials + func Open(key []byte, nonce []byte, cipherData []byte) ([]byte, error) + func ParsePrivate(password []byte, bytes []byte) (crypto.PrivateKey, error) + func PublicKeyFromRsaKey(privateKey *rsa.PrivateKey) rsa.PublicKey + func RandomBytes(size int) ([]byte, error) + func RsaKeyFromPEM(pemString string) (*rsa.PrivateKey, error) + func RsaKeyFromPEMFile(filename string) (*rsa.PrivateKey, error) + func RsaKeyToPEM(key *rsa.PrivateKey, filename ...string) (string, error) + func RsaPublicKeyToPEM(pubKey rsa.PublicKey, filename ...string) (string, error) + func Seal(key []byte, data []byte) ([]byte, error) + func SealWithNonce(key []byte, nonce []byte, data []byte) ([]byte, error) + func SetKeyringPassword(service string, user string, password []byte) error + func StoreCertificate(cert *x509.Certificate, file string, perm os.FileMode) error + func StorePrivateKey(key crypto.PrivateKey, password []byte, file string) error + func VerifySignature(data []byte, key *ecdsa.PublicKey, signature string) bool + type AESGCMEncryptionMaterials struct + func NewAESGCMMaterials(info *encryption.NodeInfo, blockHandler BlockHandler) *AESGCMEncryptionMaterials + func (m *AESGCMEncryptionMaterials) CalculateOutputSize(plainSize int64, user string) int64 + func (m *AESGCMEncryptionMaterials) Close() error + func (m *AESGCMEncryptionMaterials) Read(b []byte) (int, error) + func (m *AESGCMEncryptionMaterials) SetPlainRange(offset, length int64) + func (m *AESGCMEncryptionMaterials) SetupDecryptMode(workingKey []byte, stream io.Reader) error + func (m *AESGCMEncryptionMaterials) SetupEncryptMode(workingKey []byte, stream io.Reader) error + type BlockHandler interface + Close func() error + SendBlock func(block *encryption.Block) error + SendKey func(key *encryption.NodeKey) error + type EncryptedBlock struct + Header *EncryptedBlockHeader + HeaderSize uint32 + Payload []byte + func (b *EncryptedBlock) GetPayloadLength() uint32 + func (b *EncryptedBlock) Read(reader io.Reader) (int, error) + func (b *EncryptedBlock) SetPayload(payload []byte) error + func (b *EncryptedBlock) Write(writer io.Writer) (int, error) + type EncryptedBlockHeader struct + Nonce []byte + Options *Options + func (h *EncryptedBlockHeader) GetDataLength() uint32 + func (h *EncryptedBlockHeader) Read(reader io.Reader) (int, error) + func (h *EncryptedBlockHeader) String() string + func (h *EncryptedBlockHeader) Write(writer io.Writer) (int, error) + type EncryptedBlockHeaderOption struct + func (op *EncryptedBlockHeaderOption) GetID() uint8 + func (op *EncryptedBlockHeaderOption) GetValue() []byte + func (op *EncryptedBlockHeaderOption) HasValue() bool + func (op *EncryptedBlockHeaderOption) IsTheLast() bool + func (op *EncryptedBlockHeaderOption) Read(reader io.Reader) (int, error) + func (op *EncryptedBlockHeaderOption) SetId(id uint8) error + func (op *EncryptedBlockHeaderOption) SetIsTheLast(last bool) + func (op *EncryptedBlockHeaderOption) SetValue(value []byte) error + func (op *EncryptedBlockHeaderOption) Write(writer io.Writer) (int, error) + type Options struct + Key []byte + PartId int16 + Position int16 + UserId string + func (opts *Options) Read(reader io.Reader) (int, error) + func (opts *Options) Write(writer io.Writer) (int, error) + type Template struct + Domains []string + Expiry time.Duration + IPs []net.IP + Name string + PublicKey crypto.PublicKey + SignerCertificate *x509.Certificate + SignerPrivateKey crypto.PrivateKey Incompatible versions in this module v2.0.6+incompatible Apr 23, 2020