crypton

package module
v0.0.0-...-fd2e170 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

README

crypton : Identity through cryptography

This is the core set of classes for the crypton peer to peer identity encrypted messaging system.


github.com/steowens/crypton - Core classes for crypton identity and message system.

Copyright (C) 2023 Stephen Owens

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Documentation

Overview

github.com/steowens/crypton - Core classes for crypton identity and message system.

Copyright (C) 2023 Stephen Owens

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

github.com/steowens/crypton - Core classes for crypton identity and message system.

Copyright (C) 2023 Stephen Owens

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

github.com/steowens/crypton - Core classes for crypton identity and message system.

Copyright (C) 2023 Stephen Owens

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddressFromPublicKey

func GetAddressFromPublicKey(pubKey *ecdsa.PublicKey) string

func GetPublicKeyFromSignature

func GetPublicKeyFromSignature(hashable string, signature []byte) (pubKey *ecdsa.PublicKey, err error)

Types

type AESDecrptionStream

type AESDecrptionStream struct {
	IV []byte
	// contains filtered or unexported fields
}

func NewAESDecryptionStream

func NewAESDecryptionStream(key []byte, iv []byte, cipherTextReader io.Reader) (stream *AESDecrptionStream, err error)

func (*AESDecrptionStream) Read

func (stream *AESDecrptionStream) Read(chunk []byte) (n int, err error)

type AESEncryptionStream

type AESEncryptionStream struct {
	IV []byte
	// contains filtered or unexported fields
}

func NewAESEncryptionStream

func NewAESEncryptionStream(key []byte, plainTextReader io.Reader) (stream *AESEncryptionStream, err error)

func (*AESEncryptionStream) Read

func (stream *AESEncryptionStream) Read(chunk []byte) (n int, err error)

type Crypton

type Crypton struct {
}

func (*Crypton) DecryptWithPassword

func (c *Crypton) DecryptWithPassword(password string, value *PasswordEncryptedValue) (plainTextBytes []byte, err error)

func (*Crypton) DeformatPassword

func (c *Crypton) DeformatPassword(input string) string

Strips ' ' chars from input string

func (*Crypton) EncryptWithPassword

func (c *Crypton) EncryptWithPassword(password string, plainTextBytes []byte) (*PasswordEncryptedValue, error)

func (*Crypton) FormatPassword

func (c *Crypton) FormatPassword(password string) string

Inserts ' ' in password every 5 characters for readability

func (*Crypton) GeneratePassword

func (c *Crypton) GeneratePassword(quartets int) (string, error)

type Identity

type Identity struct {
	ID         string
	PublicName string
	Domain     string
	SigKey     SigningKey
}

func NewIdentity

func NewIdentity(publicName string, domain string, url string, port int16, password string) (ident *Identity, err error)

func (*Identity) ToRegistration

func (identity *Identity) ToRegistration() (registration *Registration, err error)

func (*Identity) Unlock

func (identity *Identity) Unlock(password string) error

type KeyAgreementKey

type KeyAgreementKey struct {
	Unlocked   bool
	PrivateKey *PasswordEncryptedValue
	PublicKey  string
	SeqNum     int64
	ActiveFrom int64
	ActiveTo   int64
	// contains filtered or unexported fields
}

func NewKeyAgreementKey

func NewKeyAgreementKey() (key *KeyAgreementKey, err error)

func (*KeyAgreementKey) Lock

func (key *KeyAgreementKey) Lock(password string) (locked *KeyAgreementKey, err error)

func (*KeyAgreementKey) Unlock

func (key *KeyAgreementKey) Unlock(password string) (unlocked *KeyAgreementKey, err error)

type PasswordEncryptedValue

type PasswordEncryptedValue struct {
	Salt       []byte
	IV         []byte
	CipherText []byte
}

type PublicProfile

type PublicProfile struct {
	ID         string
	PublicName string
	Domain     string
}

func (*PublicProfile) Hashable

func (profile *PublicProfile) Hashable() (hashable string)

func (*PublicProfile) Valid

func (profile *PublicProfile) Valid() bool

type Registration

type Registration struct {
	Profile   PublicProfile
	Signature string
}

func (*Registration) GetAddress

func (registration *Registration) GetAddress() (address string, err error)

func (*Registration) GetPublicKey

func (registration *Registration) GetPublicKey() (pubKey *ecdsa.PublicKey, err error)

type SigningKey

type SigningKey struct {
	PrivateKey *PasswordEncryptedValue
	// contains filtered or unexported fields
}

func NewSigningKey

func NewSigningKey(password string) (unlocked *SigningKey, err error)

func (*SigningKey) GetAddress

func (sk *SigningKey) GetAddress() (address string, err error)

func (*SigningKey) Sign

func (sk *SigningKey) Sign(message []byte) (signature []byte, err error)

func (*SigningKey) Unlock

func (sk *SigningKey) Unlock(password string) (unlocked *SigningKey, err error)

Directories

Path Synopsis
github.com/steowens/crypton - Core classes for crypton identity and message system.
github.com/steowens/crypton - Core classes for crypton identity and message system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL