func (c *AES) Marshal(v interface{}) ([]byte, error) {
	data, err := c.subMarshaller.Marshal(v)
	if err != nil {
		return nil, err
	}

	nonce := make([]byte, c.aesGCM.NonceSize())
	_, err = io.ReadFull(rand.Reader, nonce)
	if err != nil {
		return nil, fmt.Errorf("error reading random nonce: %w", err)
	}

	return c.aesGCM.Seal(nonce, nonce, data, nil), nil
}
// Marshal marshals the given data object to an encrypted byte array
Marshal marshals the given data object to an encrypted byte array
// Marshal marshals the given data object to an encrypted byte array
func (c *AES) Marshal(v interface{}) ([]byte, error) {
	data, err := c.subMarshaller.Marshal(v)
	if err != nil {
		return nil, err
	}
	nonce := make([]byte, c.aesGCM.NonceSize())
	_, err = io.ReadFull(rand.Reader, nonce)
	if err != nil {
		return nil, fmt.Errorf("error reading random nonce: %w", err)
	}
	return c.aesGCM.Seal(nonce, nonce, data, nil), nil
}
func ( c * AES ) Marshal ( v interface { } ) ( [ ] byte , error ) { data , err := c . subMarshaller . Marshal ( v ) if err != nil { return nil , err } nonce := make ( [ ] byte , c . aesGCM . NonceSize ( ) ) _ , err = io . ReadFull ( rand . Reader , nonce ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return c . aesGCM . Seal ( nonce , nonce , data , nil ) , nil }
Marshal marshals the given data object to an encrypted byte array
Marshal marshals the given data object to an encrypted byte array