crypto

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

* Copyright (C) 2019 Zilliqa * * 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/>.

* Copyright (C) 2019 Zilliqa * * 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/>.

* Copyright (C) 2019 Zilliqa * * 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 NewPbkdf2

func NewPbkdf2() *pbkdf2Wapper

func NewScryptWapper

func NewScryptWapper() *scryptWapper

Types

type CipherParams

type CipherParams struct {
	IV string `json:"iv"`
}

type Crypto

type Crypto struct {
	Cipher       string `json:"cipher"`
	Ciphertext   string `json:"ciphertext"`
	KDF          string `json:"kdf"`
	MAC          string `json:"mac"`
	CipherParams `json:"cipherparams"`
	KDFParams    `json:"kdfparams"`
}

type KDFParams

type KDFParams struct {
	N     int    `json:"n"`
	C     int    `json:"c"`
	R     int    `json:"r"`
	P     int    `json:"p"`
	DKlen int    `json:"dklen"`
	Salt  string `json:"salt"`
}

func NewKDFParams

func NewKDFParams(salt string) KDFParams

type KDFType

type KDFType int

0: p 1:s

type Keystore

type Keystore struct {
	// contains filtered or unexported fields
}

func NewDefaultKeystore

func NewDefaultKeystore() *Keystore

func NewKeystore

func NewKeystore(p *pbkdf2Wapper, s *scryptWapper) *Keystore

func (*Keystore) DecryptPrivateKey

func (ks *Keystore) DecryptPrivateKey(encryptJson, passphrase string) (string, error)

func (*Keystore) EncryptPrivateKey

func (ks *Keystore) EncryptPrivateKey(privateKey, passphrase []byte, t KDFType) (string, error)

func (*Keystore) GetDerivedKey

func (ks *Keystore) GetDerivedKey(password []byte, params interface{}) ([]byte, error)

type KeystoreV3

type KeystoreV3 struct {
	Address string `json:"address"`
	ID      string `json:"id"`
	Version int    `json:"version"`
	Crypto  `json:"crypto"`
}

type Pbkdf2Params

type Pbkdf2Params struct {
	Salt  []byte
	DkLen int
	Count int
}

type ScryptParams

type ScryptParams struct {
	Salt  []byte
	DkLen int
	N     int
	R     int
	P     int
}

Jump to

Keyboard shortcuts

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