Task 602: .RAP File Format
Task 602: .RAP File Format
.RAP File Format Specifications
The .RAP file format is used as a PlayStation 3 Game Rights File. It is a binary file that contains a 16-byte license key used to decrypt and activate PSN content on the PS3 or emulators like RPCS3. The format is proprietary and has no header or additional metadata; the entire file is the raw key.
1. List of all the properties of this file format intrinsic to its file system
- License Key: A 16-byte binary value representing the decryption key for the associated content.
2. Two direct download links for files of format .RAP
Sorry, I could not find legal direct download links for .RAP files, as they are proprietary Sony license files and typically obtained through legitimate purchases. Sharing or downloading them from unauthorized sources may violate terms of service or laws. You can obtain .RAP files from your own PS3 digital purchases using tools like PSN Liberator for backup purposes.
3. Ghost blog embedded HTML JavaScript for drag and drop .RAP file dump
Here is an HTML page with JavaScript that allows dragging and dropping a .RAP file to dump the license key as hex on the screen:
Drag and Drop .RAP File
4. Python class for .RAP file
import binascii
class RapFile:
def __init__(self, filepath=None):
self.key = b''
if filepath:
self.read(filepath)
def read(self, filepath):
with open(filepath, 'rb') as f:
self.key = f.read()
if len(self.key) != 16:
raise ValueError("Invalid .RAP file. Must be 16 bytes.")
print("Read .RAP file successfully.")
def decode(self):
return binascii.hexlify(self.key).decode('utf-8')
def write(self, filepath, key):
if len(key) != 16:
raise ValueError("Key must be 16 bytes.")
with open(filepath, 'wb') as f:
f.write(key)
print("Wrote .RAP file successfully.")
def print_properties(self):
if not self.key:
print("No key loaded.")
return
print(f"License Key (hex): {self.decode()}")
# Example usage
if __name__ == "__main__":
rap = RapFile("example.rap")
rap.print_properties()
# To write
sample_key = b'\x00' * 16 # Dummy key
rap.write("new.rap", sample_key)
5. Java class for .RAP file
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class RapFile {
private byte[] key = new byte[16];
public void read(String filepath) throws IOException {
byte[] data = Files.readAllBytes(Paths.get(filepath));
if (data.length != 16) {
throw new IllegalArgumentException("Invalid .RAP file. Must be 16 bytes.");
}
System.arraycopy(data, 0, key, 0, 16);
System.out.println("Read .RAP file successfully.");
}
public String decode() {
StringBuilder hex = new StringBuilder();
for (byte b : key) {
hex.append(String.format("%02X ", b));
}
return hex.toString().trim();
}
public void write(String filepath, byte[] newKey) throws IOException {
if (newKey.length != 16) {
throw new IllegalArgumentException("Key must be 16 bytes.");
}
try (FileOutputStream fos = new FileOutputStream(filepath)) {
fos.write(newKey);
}
System.out.println("Wrote .RAP file successfully.");
}
public void printProperties() {
System.out.println("License Key (hex): " + decode());
}
public static void main(String[] args) throws IOException {
RapFile rap = new RapFile();
rap.read("example.rap");
rap.printProperties();
// To write
byte[] sampleKey = new byte[16]; // Dummy key
rap.write("new.rap", sampleKey);
}
}
6. JavaScript class for .RAP file
class RapFile {
constructor() {
this.key = new Uint8Array(16);
}
async read(filepath) {
// Note: In browser, use FileReader; in Node, use fs
const fs = require('fs');
const data = fs.readFileSync(filepath);
if (data.length != 16) {
throw new Error("Invalid .RAP file. Must be 16 bytes.");
}
this.key = new Uint8Array(data);
console.log("Read .RAP file successfully.");
}
decode() {
let hex = '';
for (let byte of this.key) {
hex += byte.toString(16).padStart(2, '0') + ' ';
}
return hex.trim();
}
write(filepath, newKey) {
if (newKey.length != 16) {
throw new Error("Key must be 16 bytes.");
}
const fs = require('fs');
fs.writeFileSync(filepath, Buffer.from(newKey));
console.log("Wrote .RAP file successfully.");
}
printProperties() {
console.log(`License Key (hex): ${this.decode()}`);
}
}
// Example usage (in Node.js)
const rap = new RapFile();
rap.read('example.rap');
rap.printProperties();
// To write
const sampleKey = new Uint8Array(16); // Dummy key
rap.write('new.rap', sampleKey);
7. C class for .RAP file
(Note: C does not have classes, so this is implemented as a struct with functions in C. For full class-like behavior, use C++.)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
unsigned char key[16];
} RapFile;
void rap_read(RapFile *rap, const char *filepath) {
FILE *f = fopen(filepath, "rb");
if (f == NULL) {
perror("Error opening file");
exit(1);
}
size_t read = fread(rap->key, 1, 16, f);
fclose(f);
if (read != 16) {
fprintf(stderr, "Invalid .RAP file. Must be 16 bytes.\n");
exit(1);
}
printf("Read .RAP file successfully.\n");
}
void rap_decode(const RapFile *rap, char *hex) {
hex[0] = '\0';
for (int i = 0; i < 16; i++) {
char buf[3];
sprintf(buf, "%02X ", rap->key[i]);
strcat(hex, buf);
}
hex[strlen(hex) - 1] = '\0'; // Remove trailing space
}
void rap_write(const char *filepath, const unsigned char *newKey) {
FILE *f = fopen(filepath, "wb");
if (f == NULL) {
perror("Error opening file");
exit(1);
}
size_t written = fwrite(newKey, 1, 16, f);
fclose(f);
if (written != 16) {
fprintf(stderr, "Error writing file.\n");
exit(1);
}
printf("Wrote .RAP file successfully.\n");
}
void rap_print_properties(const RapFile *rap) {
char hex[48];
rap_decode(rap, hex);
printf("License Key (hex): %s\n", hex);
}
int main() {
RapFile rap;
rap_read(&rap, "example.rap");
rap_print_properties(&rap);
// To write
unsigned char sampleKey[16] = {0};
rap_write("new.rap", sampleKey);
return 0;
}