Documentation ¶
Index ¶
- func CalcMd5File(filename string) (string, error)
- func GenerateNonce(size int) []byte
- func GenerateStringNonce(size int) string
- func NewAesCBCDecrypt(aesKey, aesIV []byte) (cipher.BlockMode, error)
- func NewAesCBCEncrypt(aesKey, aesIV []byte) (cipher.BlockMode, error)
- func RandomBytes(size int) []byte
- func RandomString(size int) string
- func Sha1Digest(data []byte) []byte
- func Sha256Digest(data []byte) []byte
- type AES256IGECryptor
- type AesCTR128Encrypt
- type AesCTR128KeySizeError
- type AuthKey
- func (k *AuthKey) AesIgeDecrypt(msgKey, rawData []byte) ([]byte, error)
- func (k *AuthKey) AesIgeDecryptV1(msgKey, rawData []byte) ([]byte, error)
- func (k *AuthKey) AesIgeEncrypt(rawData []byte) ([]byte, []byte, error)
- func (k *AuthKey) AesIgeEncryptV1(rawData []byte) ([]byte, []byte, error)
- func (k *AuthKey) AuthKey() []byte
- func (k *AuthKey) AuthKeyId() int64
- func (k *AuthKey) Equals(o *AuthKey) bool
- type NotificationKey
- func (k *NotificationKey) AesIgeDecrypt(msgKey, rawData []byte) ([]byte, error)
- func (k *NotificationKey) AesIgeEncrypt(rawData []byte) ([]byte, []byte, error)
- func (k *NotificationKey) Equals(o *NotificationKey) bool
- func (k *NotificationKey) NotificationKey() []byte
- func (k *NotificationKey) NotificationKeyId() int64
- type PasswordKdfAlgoModPow
- type RSACryptor
- type SRPUtil
- func (m *SRPUtil) CalcClientM(newSalt1, xBytes, srpB []byte) ([]byte, []byte)
- func (m *SRPUtil) CalcClientM2(newSalt1, aBytes, ABytes, xBytes, srpB []byte) []byte
- func (m *SRPUtil) CalcM(newSalt1, vBytes, srpA, srpb, srpB []byte) []byte
- func (m *SRPUtil) CalcSRPB(vBytes []byte) ([]byte, []byte)
- func (m *SRPUtil) CalcSRPB2(bNonce, vBytes []byte) []byte
- func (m *SRPUtil) CheckNewSalt1(newSalt1 []byte) bool
- func (m *SRPUtil) GetV(newSalt1, passwordBytes []byte) *big.Int
- func (m *SRPUtil) GetVBytes(newSalt1, passwordBytes []byte) []byte
- func (m *SRPUtil) GetX(newSalt1, passwordBytes []byte) []byte
- type SfuKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcMd5File ¶
TODO(@benqi): remove to baselib
func GenerateNonce ¶
func GenerateStringNonce ¶
func RandomBytes ¶
func RandomString ¶
func Sha1Digest ¶
func Sha256Digest ¶
Types ¶
type AES256IGECryptor ¶
type AES256IGECryptor struct {
// contains filtered or unexported fields
}
func NewAES256IGECryptor ¶
func NewAES256IGECryptor(aesKey, aesIV []byte) *AES256IGECryptor
type AesCTR128Encrypt ¶
type AesCTR128Encrypt struct {
// contains filtered or unexported fields
}
func NewAesCTR128Encrypt ¶
func NewAesCTR128Encrypt(key []byte, iv []byte) (*AesCTR128Encrypt, error)
key长度必须为16、24或32
func (*AesCTR128Encrypt) Encrypt ¶
func (e *AesCTR128Encrypt) Encrypt(plaintext []byte) []byte
type AesCTR128KeySizeError ¶
type AesCTR128KeySizeError int
func (AesCTR128KeySizeError) Error ¶
func (k AesCTR128KeySizeError) Error() string
type AuthKey ¶
type AuthKey struct {
// contains filtered or unexported fields
}
func CreateAuthKey ¶
func CreateAuthKey() *AuthKey
CreateAuthKey
## android client, pushAuthKey algo:
- authKey if (SharedConfig.pushAuthKey == null) { SharedConfig.pushAuthKey = new byte[256]; Utilities.random.nextBytes(SharedConfig.pushAuthKey); SharedConfig.saveConfig(); }
- calcAuthKeyId SharedConfig.pushAuthKeyId = new byte[8]; byte[] authKeyHash = Utilities.computeSHA1(SharedConfig.pushAuthKey); System.arraycopy(authKeyHash, authKeyHash.length - 8, SharedConfig.pushAuthKeyId, 0, 8);
for bots...
func NewAuthKey ¶
func NewClientAuthKey ¶
func (*AuthKey) AesIgeDecrypt ¶
func (*AuthKey) AesIgeDecryptV1 ¶
func (*AuthKey) AesIgeEncrypt ¶
func (*AuthKey) AesIgeEncryptV1 ¶
| salt <br> int64 | `session_id` <br> int64 | `message_id` <br> int64 | `seq_no` <br> int32 |`message_data_length` <br> int32 | `message_data` <br> bytes | padding12..1024 <br> bytes| |:-:|:-:|:-:|:-:|:-:|:-:|:-:|
type NotificationKey ¶
type NotificationKey struct {
// contains filtered or unexported fields
}
func NewNotificationKey ¶
func NewNotificationKey(keyId int64, keyData []byte) *NotificationKey
func (*NotificationKey) AesIgeDecrypt ¶
func (k *NotificationKey) AesIgeDecrypt(msgKey, rawData []byte) ([]byte, error)
func (*NotificationKey) AesIgeEncrypt ¶
func (k *NotificationKey) AesIgeEncrypt(rawData []byte) ([]byte, []byte, error)
func (*NotificationKey) Equals ¶
func (k *NotificationKey) Equals(o *NotificationKey) bool
func (*NotificationKey) NotificationKey ¶
func (k *NotificationKey) NotificationKey() []byte
func (*NotificationKey) NotificationKeyId ¶
func (k *NotificationKey) NotificationKeyId() int64
type PasswordKdfAlgoModPow ¶
type RSACryptor ¶
type RSACryptor struct {
// contains filtered or unexported fields
}
func NewRSACryptor ¶
func NewRSACryptor(keyFile string) (*RSACryptor, error)
func NewRSACryptorByKeyData ¶
func NewRSACryptorByKeyData(pkcs1PemPrivateKey []byte) (*RSACryptor, error)
func (*RSACryptor) Decrypt ¶
func (m *RSACryptor) Decrypt(b []byte) []byte
func (*RSACryptor) Encrypt ¶
func (m *RSACryptor) Encrypt(b []byte) []byte
type SRPUtil ¶
type SRPUtil struct { *PasswordKdfAlgoModPow // contains filtered or unexported fields }
func MakeSRPUtil ¶
func MakeSRPUtil(algo *PasswordKdfAlgoModPow) *SRPUtil
func (*SRPUtil) CalcClientM ¶
func (*SRPUtil) CalcClientM2 ¶
func (*SRPUtil) CheckNewSalt1 ¶
type SfuKey ¶
type SfuKey struct {
// contains filtered or unexported fields
}
func (*SfuKey) AesIgeDecrypt ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.