Documentation
¶
Index ¶
- func B64ToBytes(encodedStr string) ([]byte, error)
- func B64ToString(encodedStr string) (string, error)
- func BytesToB64(input []byte) string
- func CompareTime(timestamp string, referenceTime time.Time) (bool, error)
- func CountFilesInDirectory(dir string) (int, error)
- func CreateSignature(priv *rsa.PrivateKey, message []byte) (string, error)
- func DecodePrivateKey(encoded string) (*rsa.PrivateKey, error)
- func DecodePublicKey(encoded string) (*rsa.PublicKey, error)
- func Decrypt(sk *rsa.PrivateKey, str string) (string, error)
- func DecryptAES(key []byte, msg AESEncryptedMessage) ([]byte, error)
- func EncodePrivateKey(priv *rsa.PrivateKey) string
- func EncodePublicKey(pub *rsa.PublicKey) string
- func Encrypt(pk *rsa.PublicKey, str []byte) (string, error)
- func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateRandomString(length int) (string, error)
- func Get(url string) (string, string, error)
- func GetIP(r *http.Request) string
- func In(filename string) (string, error)
- func Out(path, str string) error
- func OutBytes(path string, str []byte) error
- func Post(url string, data []byte) (string, string, error)
- func Sha(message string) string
- func StringToB64(input string) string
- func VerifySignature(pub *rsa.PublicKey, message []byte, signature string) error
- type AESEncryptedMessage
- type EncryptedMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func B64ToBytes ¶
Функция для декодирования вектора байт из Base64
func B64ToString ¶
Функция для декодирования строки из Base64
func CountFilesInDirectory ¶
func CreateSignature ¶
func CreateSignature(priv *rsa.PrivateKey, message []byte) (string, error)
Создание цифровой подписи
func DecodePrivateKey ¶
func DecodePrivateKey(encoded string) (*rsa.PrivateKey, error)
Декодирование приватного ключа из Base64
func DecodePublicKey ¶
Декодирование публичного ключа из Base64
func DecryptAES ¶
func DecryptAES(key []byte, msg AESEncryptedMessage) ([]byte, error)
func EncodePrivateKey ¶
func EncodePrivateKey(priv *rsa.PrivateKey) string
Кодирование приватного ключа в Base64
func EncodePublicKey ¶
Кодирование публичного ключа в Base64
func GenerateKeyPair ¶
Генерация пары ключей RSA
func GenerateRandomString ¶
func StringToB64 ¶
EncodeToBase64 кодирует входную строку в Base64.
Types ¶
type AESEncryptedMessage ¶
func DecodeAESMessage ¶
func DecodeAESMessage(msg []byte) (AESEncryptedMessage, error)
func EncryptAES ¶
func EncryptAES(key, msg []byte) (AESEncryptedMessage, error)
func (AESEncryptedMessage) EncodeAESMessage ¶
func (msg AESEncryptedMessage) EncodeAESMessage() ([]byte, error)
type EncryptedMessage ¶
type EncryptedMessage struct { IV string `json:"iv"` Key string `json:"key"` Message string `json:"message"` }
func NewEncryptedMessage ¶
func NewEncryptedMessage(jsonStr string) (EncryptedMessage, error)
func (EncryptedMessage) String ¶
func (msg EncryptedMessage) String() (string, error)
Click to show internal directories.
Click to hide internal directories.