Documentation
¶
Index ¶
- func DecodeHybridAESRSAEncryptedPayload(p *HybridAESRSAEncryptedPayload) (cipher, key, nonce []byte, err error)
- func DecryptHybridAESRSAEncryptedPayloadFromBytes(block []byte, payload *HybridAESRSAEncryptedPayload) (decrypted []byte, err error)
- func DecryptHybridAESRSAEncryptedPayloadFromPrivateKey(privateKeyPath string, payload *HybridAESRSAEncryptedPayload) (decrypted []byte, err error)
- func ParsePEMBlock(path string) (block *pem.Block, err error)
- type HybridAESRSAEncryptedPayload
- func EncodeHybridAESRSAEncryptedPayload(cipher, key, nonce []byte) (p *HybridAESRSAEncryptedPayload)
- func EncryptHybridAESRSAEncryptedPayloadFromBytes(block []byte, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
- func EncryptHybridAESRSAEncryptedPayloadFromCertificate(certPath string, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
- func EncryptHybridAESRSAEncryptedPayloadFromPublickKeyBytes(publicKeyBytes []byte, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeHybridAESRSAEncryptedPayload ¶
func DecodeHybridAESRSAEncryptedPayload(p *HybridAESRSAEncryptedPayload) (cipher, key, nonce []byte, err error)
func DecryptHybridAESRSAEncryptedPayloadFromBytes ¶
func DecryptHybridAESRSAEncryptedPayloadFromBytes(block []byte, payload *HybridAESRSAEncryptedPayload) (decrypted []byte, err error)
DecryptHybridAESRSAEncryptedPayloadFromBytes takes a path to an RSA private key PEM file and uses it to decode the AES key in a hybrid encoded payload. This AES key is then used to decode the actual payload contents. Information of the use of hybrid AES RSA encryption can be found here https://www.ijrar.org/papers/IJRAR23B1852.pdf
func DecryptHybridAESRSAEncryptedPayloadFromPrivateKey ¶
func DecryptHybridAESRSAEncryptedPayloadFromPrivateKey(privateKeyPath string, payload *HybridAESRSAEncryptedPayload) (decrypted []byte, err error)
DecryptHybridAESRSAEncryptedPayloadFromPrivateKey takes a path to an RSA private key and uses it to decode the AES key in a hybrid encoded payload. This AES key is then used to decode the actual payload contents. Information of the use of hybrid AES RSA encryption can be found here https://www.ijrar.org/papers/IJRAR23B1852.pdf
Types ¶
type HybridAESRSAEncryptedPayload ¶
type HybridAESRSAEncryptedPayload struct { // Ciphertext contains the encrypted contents CipherText string `json:"cipher_text" yaml:"cipher_text" mapstructure:"cipher_text"` // EncryptedKey contains the encryped AES key used to encrypt the data EncryptedKey string `json:"encrypted_key" yaml:"encrypted_key" mapstructure:"encrypted_key"` // Nonce used for encryption is required during decryption Nonce string `json:"nonce" yaml:"nonce" mapstructure:"nonce"` }
func EncodeHybridAESRSAEncryptedPayload ¶
func EncodeHybridAESRSAEncryptedPayload(cipher, key, nonce []byte) (p *HybridAESRSAEncryptedPayload)
func EncryptHybridAESRSAEncryptedPayloadFromBytes ¶
func EncryptHybridAESRSAEncryptedPayloadFromBytes(block []byte, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
EncryptHybridAESRSAEncryptedPayloadFromBytes takes an x509 certificate for key encypherment and uses it to encode a payload using hybrid RSA AES encryption where an AES key is used to encrypt the content in payload and the AES key is encrypted using RSA encryption. AES encryption is used to encode the payload itself as it is faster than RSA for larger payloads. RSA is used to encrypt the relatively small AES key and allows asymmetric encryption whilst also being fast. More information can be found at https://www.ijrar.org/papers/IJRAR23B1852.pdf
func EncryptHybridAESRSAEncryptedPayloadFromCertificate ¶
func EncryptHybridAESRSAEncryptedPayloadFromCertificate(certPath string, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
EncryptHybridAESRSAEncryptedPayloadFromCertificate takes a path to a valid x509 certificate for key encypherment and uses it to encode a payload using hybrid RSA AES encryption where an AES key is used to encrypt the content in payload and the AES key is encrypted using RSA encryption. AES encryption is used to encode the payload itself as it is faster than RSA for larger payloads. RSA is used to encrypt the relatively small AES key and allows asymmetric encryption whilst also being fast. More information can be found at https://www.ijrar.org/papers/IJRAR23B1852.pdf
func EncryptHybridAESRSAEncryptedPayloadFromPublickKeyBytes ¶ added in v1.88.0
func EncryptHybridAESRSAEncryptedPayloadFromPublickKeyBytes(publicKeyBytes []byte, payload []byte) (encrypted *HybridAESRSAEncryptedPayload, err error)
EncryptHybridAESRSAEncryptedPayloadFromPublickKeyBytes takes a public key for key encypherment and uses it to encode a payload using hybrid RSA AES encryption where an AES key is used to encrypt the content in payload and the AES key is encrypted using RSA encryption. AES encryption is used to encode the payload itself as it is faster than RSA for larger payloads. RSA is used to encrypt the relatively small AES key and allows asymmetric encryption whilst also being fast. More information can be found at https://www.ijrar.org/papers/IJRAR23B1852.pdf
func (*HybridAESRSAEncryptedPayload) Validate ¶
func (p *HybridAESRSAEncryptedPayload) Validate() (err error)