Documentation ¶
Overview ¶
Package oqs provides a GO wrapper for the C liboqs quantum-resistant library.
Index ¶
- func EnabledKEMs() []string
- func EnabledSigs() []string
- func IsKEMEnabled(algName string) bool
- func IsKEMSupported(algName string) bool
- func IsSigEnabled(algName string) bool
- func IsSigSupported(algName string) bool
- func KEMName(algID int) (string, error)
- func LiboqsVersion() string
- func MaxNumberKEMs() int
- func MaxNumberSigs() int
- func MemCleanse(v []byte)
- func SigName(algID int) (string, error)
- func SupportedKEMs() []string
- func SupportedSigs() []string
- type KeyEncapsulation
- func (kem *KeyEncapsulation) Clean()
- func (kem *KeyEncapsulation) DecapSecret(ciphertext []byte) ([]byte, error)
- func (kem *KeyEncapsulation) Details() KeyEncapsulationDetails
- func (kem *KeyEncapsulation) EncapSecret(publicKey []byte) (ciphertext, sharedSecret []byte, err error)
- func (kem *KeyEncapsulation) ExportSecretKey() []byte
- func (kem *KeyEncapsulation) GenerateKeyPair() ([]byte, error)
- func (kem *KeyEncapsulation) Init(algName string, secretKey []byte) error
- func (kem KeyEncapsulation) String() string
- type KeyEncapsulationDetails
- type Signature
- func (sig *Signature) Clean()
- func (sig *Signature) Details() SignatureDetails
- func (sig *Signature) ExportSecretKey() []byte
- func (sig *Signature) GenerateKeyPair() ([]byte, error)
- func (sig *Signature) Init(algName string, secretKey []byte) error
- func (sig *Signature) Sign(message []byte) ([]byte, error)
- func (sig Signature) String() string
- func (sig *Signature) Verify(message []byte, signature []byte, publicKey []byte) (bool, error)
- type SignatureDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnabledKEMs ¶
func EnabledKEMs() []string
EnabledKEMs returns the list of enabled KEM algorithms.
func EnabledSigs ¶
func EnabledSigs() []string
EnabledSigs returns the list of enabled signature algorithms.
func IsKEMEnabled ¶
IsKEMEnabled returns true if a KEM algorithm is enabled, and false otherwise.
func IsKEMSupported ¶
IsKEMSupported returns true if a KEM algorithm is supported, and false otherwise.
func IsSigEnabled ¶
IsSigEnabled returns true if a signature algorithm is enabled, and false otherwise.
func IsSigSupported ¶
IsSigSupported returns true if a signature algorithm is supported, and false otherwise.
func LiboqsVersion ¶
func LiboqsVersion() string
LiboqsVersion retrieves the underlying liboqs version string.
func MaxNumberKEMs ¶
func MaxNumberKEMs() int
MaxNumberKEMs returns the maximum number of supported KEM algorithms.
func MaxNumberSigs ¶
func MaxNumberSigs() int
MaxNumberSigs returns the maximum number of supported signature algorithms.
func MemCleanse ¶
func MemCleanse(v []byte)
MemCleanse sets to zero the content of a byte slice by invoking the liboqs OQS_MEM_cleanse() function. Use it to clean "hot" memory areas, such as secret keys etc.
func SupportedKEMs ¶
func SupportedKEMs() []string
SupportedKEMs returns the list of supported KEM algorithms.
func SupportedSigs ¶
func SupportedSigs() []string
SupportedSigs returns the list of supported signature algorithms.
Types ¶
type KeyEncapsulation ¶
type KeyEncapsulation struct {
// contains filtered or unexported fields
}
KeyEncapsulation defines the KEM main data structure.
func (*KeyEncapsulation) Clean ¶
func (kem *KeyEncapsulation) Clean()
Clean zeroes-in the stored secret key and resets the kem receiver. One can reuse the KEM by re-initializing it with the KeyEncapsulation.Init method.
func (*KeyEncapsulation) DecapSecret ¶
func (kem *KeyEncapsulation) DecapSecret(ciphertext []byte) ([]byte, error)
DecapSecret decapsulates a ciphertexts and returns the corresponding shared secret.
func (*KeyEncapsulation) Details ¶
func (kem *KeyEncapsulation) Details() KeyEncapsulationDetails
Details returns the KEM algorithm details.
func (*KeyEncapsulation) EncapSecret ¶
func (kem *KeyEncapsulation) EncapSecret(publicKey []byte) (ciphertext, sharedSecret []byte, err error, )
EncapSecret encapsulates a secret using a public key and returns the corresponding ciphertext and shared secret.
func (*KeyEncapsulation) ExportSecretKey ¶
func (kem *KeyEncapsulation) ExportSecretKey() []byte
ExportSecretKey exports the corresponding secret key from the kem receiver.
func (*KeyEncapsulation) GenerateKeyPair ¶
func (kem *KeyEncapsulation) GenerateKeyPair() ([]byte, error)
GenerateKeyPair generates a pair of secret key/public key and returns the public key. The secret key is stored inside the kem receiver. The secret key is not directly accessible, unless one exports it with KeyEncapsulation.ExportSecretKey method.
func (*KeyEncapsulation) Init ¶
func (kem *KeyEncapsulation) Init(algName string, secretKey []byte) error
Init initializes the KEM data structure with an algorithm name and a secret key. If the secret key is null, then the user must invoke the KeyEncapsulation.GenerateKeyPair method to generate the pair of secret key/public key.
func (KeyEncapsulation) String ¶
func (kem KeyEncapsulation) String() string
String converts the KEM algorithm name to a string representation. Use this method to pretty-print the KEM algorithm name, e.g. fmt.Println(client).
type KeyEncapsulationDetails ¶
type KeyEncapsulationDetails struct { ClaimedNISTLevel int IsINDCCA bool LengthCiphertext int LengthPublicKey int LengthSecretKey int Name string Version string }
KeyEncapsulationDetails defines the KEM algorithm details.
func (KeyEncapsulationDetails) String ¶
func (kemDetails KeyEncapsulationDetails) String() string
String converts the KEM algorithm details to a string representation. Use this method to pretty-print the KEM algorithm details, e.g. fmt.Println(client.Details()).
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature defines the signature main data structure.
func (*Signature) Clean ¶
func (sig *Signature) Clean()
Clean zeroes-in the stored secret key and resets the sig receiver. One can reuse the signature by re-initializing it with the Signature.Init method.
func (*Signature) Details ¶
func (sig *Signature) Details() SignatureDetails
Details returns the signature algorithm details.
func (*Signature) ExportSecretKey ¶
ExportSecretKey exports the corresponding secret key from the sig receiver.
func (*Signature) GenerateKeyPair ¶
GenerateKeyPair generates a pair of secret key/public key and returns the public key. The secret key is stored inside the sig receiver. The secret key is not directly accessible, unless one exports it with Signature.ExportSecretKey method.
func (*Signature) Init ¶
Init initializes the signature data structure with an algorithm name and a secret key. If the secret key is null, then the user must invoke the Signature.GenerateKeyPair method to generate the pair of secret key/public key.
type SignatureDetails ¶
type SignatureDetails struct { ClaimedNISTLevel int IsEUFCMA bool LengthPublicKey int LengthSecretKey int MaxLengthSignature int Name string Version string }
SignatureDetails defines the signature algorithm details.
func (SignatureDetails) String ¶
func (sigDetails SignatureDetails) String() string
String converts the signature algorithm details to a string representation. Use this method to pretty-print the signature algorithm details, e.g. fmt.Println(signer.Details()).