Documentation
¶
Index ¶
- Constants
- Variables
- func CreateRSAPrivateKey(directory, name string, password []byte) (*rsa.PrivateKey, error)
- func CreateSignature(algorithm SignatureAlgorithm, privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
- func DecryptAESGCM(key, encrypted []byte) ([]byte, error)
- func DecryptKey(algorithm EncryptionAlgorithm, secret []byte, key *rsa.PrivateKey) ([]byte, error)
- func DecryptPayload(algorithm EncryptionAlgorithm, payload []byte, key []byte) ([]byte, error)
- func EncryptAESGCM(key, payload []byte) ([]byte, error)
- func ExportKeys(host, keystore, name string, password []byte) (string, error)
- func GenerateRandomKey(bytes int) ([]byte, error)
- func HasRSAPrivateKey(directory, name string) bool
- func Hash(data []byte) []byte
- func HashProtobuf(protobuf proto.Message) ([]byte, error)
- func ImportKeys(host, keystore, name, accessCode string) error
- func KeyShareHandler(keys KeyShareStore, timeout time.Duration) func(w http.ResponseWriter, r *http.Request)
- func ListRSAPrivateKeys(directory string) ([]string, error)
- func LoadRSAPrivateKey(directory, name string) (*rsa.PrivateKey, error)
- func ParseRSAPrivateKey(format PrivateKeyFormat, privateKey []byte) (*rsa.PrivateKey, error)
- func ParseRSAPublicKey(format PublicKeyFormat, publicKey []byte) (*rsa.PublicKey, error)
- func Password() ([]byte, error)
- func PrivateKeyToRSAPrivateKey(key interface{}) (*rsa.PrivateKey, error)
- func PublicKeyToRSAPublicKey(key interface{}) (*rsa.PublicKey, error)
- func RSAPrivateKey(directory, name string, password []byte) (*rsa.PrivateKey, error)
- func RSAPrivateKeyFromPKCS1Bytes(data []byte) (*rsa.PrivateKey, error)
- func RSAPrivateKeyFromPKCS8Bytes(data []byte) (*rsa.PrivateKey, error)
- func RSAPrivateKeyToPEM(privateKey *rsa.PrivateKey, password []byte) (*pem.Block, error)
- func RSAPrivateKeyToPKCS1Bytes(privateKey *rsa.PrivateKey) []byte
- func RSAPrivateKeyToPKCS8Bytes(privateKey *rsa.PrivateKey) ([]byte, error)
- func RSAPublicKeyFromPKCS1Bytes(data []byte) (*rsa.PublicKey, error)
- func RSAPublicKeyFromPKIXBytes(data []byte) (*rsa.PublicKey, error)
- func RSAPublicKeyToPEM(publicKey *rsa.PublicKey) (*pem.Block, error)
- func RSAPublicKeyToPKCS1Bytes(publicKey *rsa.PublicKey) []byte
- func RSAPublicKeyToPKIXBytes(publicKey *rsa.PublicKey) ([]byte, error)
- func RandomString(size uint) (string, error)
- func ReadPEM(filename string) (*pem.Block, error)
- func ReadPassword(prompt string) ([]byte, error)
- func VerifySignature(algorithm SignatureAlgorithm, publicKey *rsa.PublicKey, data, signature []byte) error
- func WritePEM(key *pem.Block, filename string) error
- func WriteRSAPrivateKey(privateKey *rsa.PrivateKey, directory, name string, password []byte) error
- type CompressionAlgorithm
- type EncryptionAlgorithm
- type ErrExportFailed
- type ErrPasswordTooShort
- type ErrPasswordsDoNotMatch
- type ErrUnsupportedEncryption
- type ErrUnsupportedPrivateKeyFormat
- type ErrUnsupportedPrivateKeyType
- type ErrUnsupportedPublicKeyFormat
- type ErrUnsupportedPublicKeyType
- type ErrUnsupportedSignature
- type KeyShare
- func (*KeyShare) Descriptor() ([]byte, []int)
- func (m *KeyShare) GetName() string
- func (m *KeyShare) GetPassword() []byte
- func (m *KeyShare) GetPrivateFormat() PrivateKeyFormat
- func (m *KeyShare) GetPrivateKey() []byte
- func (m *KeyShare) GetPublicFormat() PublicKeyFormat
- func (m *KeyShare) GetPublicKey() []byte
- func (*KeyShare) ProtoMessage()
- func (m *KeyShare) Reset()
- func (m *KeyShare) String() string
- func (m *KeyShare) XXX_DiscardUnknown()
- func (m *KeyShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KeyShare) XXX_Merge(src proto.Message)
- func (m *KeyShare) XXX_Size() int
- func (m *KeyShare) XXX_Unmarshal(b []byte) error
- type KeyShareStore
- type PrivateKeyFormat
- type PublicKeyFormat
- type SignatureAlgorithm
Constants ¶
View Source
const ( AES_128_KEY_SIZE_BITS = 128 AES_128_KEY_SIZE_BYTES = AES_128_KEY_SIZE_BITS / 8 AES_256_KEY_SIZE_BITS = 256 AES_256_KEY_SIZE_BYTES = AES_256_KEY_SIZE_BITS / 8 MIN_PASSWORD = 12 )
Variables ¶
View Source
var CompressionAlgorithm_name = map[int32]string{
0: "UNKNOWN_COMPRESSION",
}
View Source
var CompressionAlgorithm_value = map[string]int32{
"UNKNOWN_COMPRESSION": 0,
}
View Source
var EncryptionAlgorithm_name = map[int32]string{
0: "UNKNOWN_ENCRYPTION",
1: "AES_128_GCM_NOPADDING",
2: "PBKDF2WITHHMACSHA1",
3: "RSA_ECB_OAEPPADDING",
4: "AES_256_GCM_NOPADDING",
}
View Source
var EncryptionAlgorithm_value = map[string]int32{
"UNKNOWN_ENCRYPTION": 0,
"AES_128_GCM_NOPADDING": 1,
"PBKDF2WITHHMACSHA1": 2,
"RSA_ECB_OAEPPADDING": 3,
"AES_256_GCM_NOPADDING": 4,
}
View Source
var PrivateKeyFormat_name = map[int32]string{
0: "UNKNOWN_PRIVATE_KEY_FORMAT",
1: "PKCS1_PRIVATE",
2: "PKCS8",
}
View Source
var PrivateKeyFormat_value = map[string]int32{
"UNKNOWN_PRIVATE_KEY_FORMAT": 0,
"PKCS1_PRIVATE": 1,
"PKCS8": 2,
}
View Source
var PublicKeyFormat_name = map[int32]string{
0: "UNKNOWN_PUBLIC_KEY_FORMAT",
1: "PKCS1_PUBLIC",
2: "PKIX",
3: "X509",
}
View Source
var PublicKeyFormat_value = map[string]int32{
"UNKNOWN_PUBLIC_KEY_FORMAT": 0,
"PKCS1_PUBLIC": 1,
"PKIX": 2,
"X509": 3,
}
View Source
var SignatureAlgorithm_name = map[int32]string{
0: "UNKNOWN_SIGNATURE",
1: "SHA512WITHRSA",
2: "SHA512WITHRSA_PSS",
}
View Source
var SignatureAlgorithm_value = map[string]int32{
"UNKNOWN_SIGNATURE": 0,
"SHA512WITHRSA": 1,
"SHA512WITHRSA_PSS": 2,
}
Functions ¶
func CreateRSAPrivateKey ¶
func CreateRSAPrivateKey(directory, name string, password []byte) (*rsa.PrivateKey, error)
func CreateSignature ¶
func CreateSignature(algorithm SignatureAlgorithm, privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
func DecryptAESGCM ¶
func DecryptKey ¶
func DecryptKey(algorithm EncryptionAlgorithm, secret []byte, key *rsa.PrivateKey) ([]byte, error)
func DecryptPayload ¶
func DecryptPayload(algorithm EncryptionAlgorithm, payload []byte, key []byte) ([]byte, error)
func EncryptAESGCM ¶
func GenerateRandomKey ¶
func HasRSAPrivateKey ¶
func ImportKeys ¶
func KeyShareHandler ¶
func KeyShareHandler(keys KeyShareStore, timeout time.Duration) func(w