Posts

Showing posts with the label RSA

Go Language - RSA Encryption And Decryption PKCS Example

Image
The RSA algorithm (Rivest-Shamir-Adleman) is a cryptographic algorithm that is used for specific security services or purposes, which enables public-key encryption and is widely used to secure sensitive data, particularly when it is being sent over an insecure network such as the HTTP. A public key is shared publicly, while a private key is secret and must not be shared with anyone. The following illustration highlights how asymmetric cryptography works: RSA Encryption and Decryption with PKCS1v15 Example, package main //Required imports for Encryption & Decryption import ( "crypto/rand" "crypto/rsa" "encoding/base64" "fmt" ) func main() { //2048 is the number of bits for RSA bitSize := 2048 //Generate RSA keys privateKey, err := rsa. GenerateKey(rand.Reader, bitSize) if err != nil { panic(err) } publicKey := privateKey.PublicKey //Your secret text secretMessage := "

Kotlin- RSA, AES, 3DES Encryption and Decryption with example

Image
Quick Overview - RSA The RSA algorithm (Rivest-Shamir-Adleman) is a cryptographic algorithm that is used for specific security services or purposes, which enables public-key encryption and is widely used to secure sensitive data, particularly when it is being sent over an insecure network such as the HTTP. A public key is shared publicly, while a private key is secret and must not be shared with anyone. The following illustration highlights how asymmetric cryptography works: Example 1 :  RSA Encryption and Decryption The Cipher Type: RSA/ECB/PKCS1Padding import java.security.spec.PKCS8EncodedKeySpec import javax.crypto.Cipher import java.security.spec.X509EncodedKeySpec import java.io.IOException import java.security.* import java.util.* class RSADemo { var privateKey: PrivateKey var publicKey: PublicKey companion object { // convert String publickey to Key object @Throws (GeneralSecurityException:: class , IOException:: class ) fun loadP