Crypto
The Crypto registry includes essential cryptographic tools for enhancing security in your projects, such as encryption, decryption, certificates generations.
Last updated
The Crypto registry includes essential cryptographic tools for enhancing security in your projects, such as encryption, decryption, certificates generations.
Last updated
You can easily import all the functions from the crypto
registry by including the following import statement in your code
Directly using cryptographic functions in templates poses significant security risks. This package is included in Sprout solely for backward compatibility with Sprig.
We strongly recommend generating certificates and performing other cryptographic operations outside of templates to maintain security and follow best practices.
In future versions, this package will be removed from Sprout.
The function generates a bcrypt hash from the given input string, providing a secure way to store passwords or other sensitive data.
Be careful, this method uses the default cost of the library and can cause security vulnerabilities.
The function generates an Htpasswd hash from the given username and password strings, typically used for basic authentication in web servers.
Be careful, this method uses the default cost of the library and can cause security vulnerabilities.
The function derives a password based on the provided counter, password type, password, user, and site, generating a consistent and secure password using these inputs.
The function generates a private key of the specified type, allowing for the creation of cryptographic keys used in various security protocols.
The function builds a custom certificate using a base64 encoded certificate and private key, enabling the creation of customized SSL/TLS certificates for secure communications.
Generates a certificate authority (CA) using the provided common name and validity period, creating the root certificate needed to sign other certificates.
Generates a certificate authority using the provided common name, validity period, and an existing private key in PEM format, allowing for more customized or pre-existing key usage in CA creation.
The function generates a new, self-signed x509 certificate using a 2048-bit RSA private key, allowing for secure communication without relying on an external certificate authority.
The function generates a new, self-signed x509 certificate using a provided private key in PEM format. This allows you to create a self-signed certificate with an existing PEM-encoded private key, offering more control over the certificate generation process.
The function generates a new x509 certificate that is signed by a given Certificate Authority (CA) certificate. This allows for the creation of certificates that are trusted by the CA, ensuring secure communication within a trusted network.
The function generates a new, signed x509 certificate using a given Certificate Authority (CA) certificate and a private key in PEM format. This allows for the creation of a certificate that is not only signed by a trusted CA but also utilizes a specific PEM-encoded private key, ensuring secure and authenticated communication.
The function encrypts a plaintext string using AES encryption, with the encryption key derived from the provided password. This ensures that the data is securely encrypted, making it unreadable without the correct password.
The function decrypts a base64-encoded string that was encrypted using AES encryption, using the provided password to return the original plaintext.
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature
Signature