Documentation
¶
Index ¶
- Variables
- type PrivateKey
- func (k *PrivateKey) BitLen() int
- func (k *PrivateKey) Decrypt(encryptedMessage []byte) ([]byte, error)
- func (k *PrivateKey) Encode() []byte
- func (k *PrivateKey) EncodePKCS1DER() []byte
- func (k *PrivateKey) MarshalBSONValue() (bsontype.Type, []byte, error)
- func (k *PrivateKey) MarshalJSON() ([]byte, error)
- func (k *PrivateKey) Public() *PublicKey
- func (k *PrivateKey) Sign(message []byte) ([]byte, error)
- func (k *PrivateKey) ToB64() string
- func (k *PrivateKey) UnmarshalBSONValue(t bsontype.Type, bu []byte) error
- func (k *PrivateKey) UnmarshalJSON(b []byte) error
- type PublicKey
- func (k *PublicKey) BitLen() int
- func (k *PublicKey) Encode() []byte
- func (k *PublicKey) Encrypt(message []byte) ([]byte, error)
- func (k *PublicKey) GetHash() string
- func (k *PublicKey) MarshalJSON() ([]byte, error)
- func (k *PublicKey) ToB64() string
- func (k *PublicKey) UnmarshalJSON(b []byte) error
- func (k *PublicKey) Verify(message, signature []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorPrivateKeyDecodeUnknownKeyType is returned when a decoded private key is of an invalid type ErrorPrivateKeyDecodeUnknownKeyType = utils.NewSealdError("ASYMKEY_PRIVATE_KEY_DECODE_UNKNOWN_KEY_TYPE", "PrivateKeyDecode: unknown key type") // ErrorGenerateInvalidSize is returned when an invalid key size is given at key generation ErrorGenerateInvalidSize = utils.NewSealdError("ASYMKEY_GENERATE_INVALID_SIZE", "Cannot generate a Private Key of given bit length. Acceptable values are 1024, 2049 and 4096") // ErrorUnmarshalBSONValueTooShort is returned when trying to unmarshal a bson that is too short ErrorUnmarshalBSONValueTooShort = utils.NewSealdError("ASYMKEY_UNMARSHALL_BSON_VALUE_TOO_SHORT", "Cannot unmarshal, not enough bytes") // ErrorUnmarshalBSONValueInvalidType is returned when trying to unmarshal a bson that is not a string ErrorUnmarshalBSONValueInvalidType = utils.NewSealdError("ASYMKEY_UNMARSHALL_BSON_VALUE_INVALID_TYPE", "Cannot unmarshal, type is not String") // ErrorDecryptCryptoRSA is returned when an error happen during decryption ErrorDecryptCryptoRSA = utils.NewSealdError("ASYMKEY_DECRYPT_CRYPTO_ERROR", "Cannot decrypt") // ErrorPublicKeyDecodeUnknownKeyType is returned when a decoded public key is of an invalid type ErrorPublicKeyDecodeUnknownKeyType = utils.NewSealdError("ASYMKEY_PUBLIC_KEY_DECODE_UNKNOWN_KEY_TYPE", "PublicKeyDecode: unknown key type") )
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func Generate ¶
func Generate(bits int) (*PrivateKey, error)
func PrivateKeyDecode ¶
func PrivateKeyDecode(key []byte) (*PrivateKey, error)
func PrivateKeyDecodePKCS1DER ¶
func PrivateKeyDecodePKCS1DER(key []byte) (*PrivateKey, error)
func PrivateKeyFromB64 ¶
func PrivateKeyFromB64(b64 string) (*PrivateKey, error)
func (*PrivateKey) BitLen ¶
func (k *PrivateKey) BitLen() int
func (*PrivateKey) Encode ¶
func (k *PrivateKey) Encode() []byte
func (*PrivateKey) EncodePKCS1DER ¶
func (k *PrivateKey) EncodePKCS1DER() []byte
func (*PrivateKey) MarshalBSONValue ¶
func (k *PrivateKey) MarshalBSONValue() (bsontype.Type, []byte, error)
func (*PrivateKey) MarshalJSON ¶
func (k *PrivateKey) MarshalJSON() ([]byte, error)
func (*PrivateKey) Public ¶
func (k *PrivateKey) Public() *PublicKey
func (*PrivateKey) ToB64 ¶
func (k *PrivateKey) ToB64() string
func (*PrivateKey) UnmarshalBSONValue ¶
func (k *PrivateKey) UnmarshalBSONValue(t bsontype.Type, bu []byte) error
func (*PrivateKey) UnmarshalJSON ¶
func (k *PrivateKey) UnmarshalJSON(b []byte) error
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func PublicKeyDecode ¶
func PublicKeyFromB64 ¶
func (*PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.