cwe-780-rsa-without-oaep

Converts RSA PKCS1Padding usage to OAEPWithSHA-256AndMGF1 in Java code.

3|1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/DevelopersCoffee/java-cwe-security-skills --skill cwe-780-rsa-without-oaep
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cwe-780-rsa-without-oaep
Source: https://github.com/DevelopersCoffee/java-cwe-security-skills/tree/main/cwe-780-rsa-without-oaep
Command: npx skills add https://github.com/DevelopersCoffee/java-cwe-security-skills --skill cwe-780-rsa-without-oaep

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical security vulnerability of using RSA encryption without proper OAEP padding, which can expose sensitive data to cryptographic attacks.

Core Features & Use Cases

  • Vulnerability Remediation: Identifies and provides secure alternatives for RSA implementations using weak PKCS1 padding.
  • Secure Cryptography: Ensures the use of modern, robust padding schemes like OAEP for RSA encryption.
  • Use Case: When a security audit flags the use of "RSA/ECB/PKCS1Padding" in your Java application, this Skill provides the exact code to replace it with the more secure "RSA/ECB/OAEPWithSHA-256AndMGF1Padding".

Quick Start

Remediate the CWE-780 vulnerability in the provided Java code snippet by replacing PKCS1Padding with OAEPWithSHA-256AndMGF1Padding.

Frequently Asked Questions about cwe-780-rsa-without-oaep

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Java application have a CWE-780 RSA without OAEP padding vulnerability?

Using RSA encryption with PKCS1Padding triggers CWE-780 because it lacks OAEP padding, exposing sensitive data to cryptographic attacks. Replacing it with OAEPWithSHA-256AndMGF1Padding remediates this vulnerability.

How do I fix RSA encryption in Java to use OAEP padding instead of PKCS1?

To fix RSA encryption using OAEP padding, replace the insecure "RSA/ECB/PKCS1Padding" cipher instance with "RSA/ECB/OAEPWithSHA-256AndMGF1Padding" and explicitly implement OAEPParameterSpec for secure configuration.

What is the best way to remediate SAST findings for cryptographic failures in Java?

The best way to remediate SAST findings for cryptographic failures in Java is to replace weak PKCS1 padding with OAEP padding, ensuring robust cryptographic schemes are used for RSA encryption.

Do I need OAEPParameterSpec to secure RSA encryption in Java?

Yes, explicit implementation of OAEPParameterSpec is required to properly secure RSA encryption in Java, ensuring the cryptographic parameters for OAEP padding are correctly applied.

Can I use RSA OAEP padding to pass security audits for Java applications?

Yes, replacing insecure PKCS1 padding with OAEPWithSHA-256AndMGF1Padding satisfies security audit requirements by remediating CWE-780 vulnerabilities and ensuring robust cryptographic practices in Java.

When should I not use PKCS1Padding for RSA encryption?

You should never use PKCS1Padding for RSA encryption when handling sensitive data, as it is vulnerable to cryptographic attacks and will be flagged during security reviews as a CWE-780 vulnerability.