Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.security.Key;

import javax.crypto.Cipher;

public class Main {
    private static byte[] Rsa(byte[] byteData, Key pKey, int opmode) throws Exception {
        Cipher cipher = null;
        try {
            cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
            cipher.init(opmode, pKey);

            return cipher.doFinal(byteData);
        } finally {
            cipher = null;
        }
    }
}