package com.zhiqiyun;

import com.dliyun.oap.framework.security.algorithm.Rsa;

public class Test {
    public static void main(String[] args) throws Exception {
        Rsa.RsaKeys rsaKeys = Rsa.genKeyPair();
        String p1 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIy" +
                "MjI3MTIiLCJ1c2VyX25hbWUiOiJhZG1pbiIsInJlYWxfbmFtZSI6ImFkbWluIiwiYXZhd" +
                "GFyIjoiIiwiYXV0aG9yaXRpZXMiOlsiYWRtaW4iXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2" +
                "xlX25hbWUiOiJhZG1pbiIsImxpY2Vuc2UiOiJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQi" +
                "OiIxNDgxNTQ4Njc1NjA2MDQ0Njc0IiwidXNlcl9pZCI6IjE0ODE1NDg2NzkyNjQ3MjcwNDEiLCJyb2" +
                "xlX2lkIjoiMTQ4MTU0ODY3Mzc4MTUyMjQzMyIsInNjb3BlIjpbImFsbCJdLCJuaWNrX25hbWUiOiJhZG" +
                "1pbiIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7InR5cGUiOiJ3ZWIifSwiZXhwIjoxNjQyNDEyMDYyLC" +
                "JkZXB0X2lkIjoiMTQ4MTU0ODY3NTU5NzY1NjA2NiIsImp0aSI6ImFiMmExYmY3LTdjNDYtNGQ2MC1iMm" +
                "MxLWY4MjMwOTgyMmU5YyIsImFjY291bnQiOiJhZG1pbiJ9.stMyV_h0Z1bljzS_Q_pkUvU91EX-KKybz" +
                "cyWwgwa560eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIyMjI3MTIiLCJ1c" +
                "2VyX25hbWUiOiJhZG1pbiIsInJlYWxfbmFtZSI6ImFkbWluIiwiYXZhdGFyIjoiIiwiYXV0aG9yaXRpZX" +
                "MiOlsiYWRtaW4iXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2xlX25hbWUiOiJhZG1pbiIsImxpY2Vuc2UiO" +
                "iJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQiOiIxNDgxNTQ4Njc1NjA2MDQ0Njc0IiwidXNlcl9pZCI" +
                "6IjE0ODE1NDg2NzkyNjQ3MjcwNDEiLCJyb2xlX2lkIjoiMTQ4MTU0ODY3Mzc4MTUyMjQzMyIsInNjb3BlI" +
                "jpbImFsbCJdLCJuaWNrX25hbWUiOiJhZG1pbiIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7InR5cGUiOiJ" +
                "3ZWIifSwiZXhwIjoxNjQyNDEyMDYyLCJkZXB0X2lkIjoiMTQ4MTU0ODY3NTU5NzY1NjA2NiIsImp0aSI6I" +
                "mFiMmExYmY3LTdjNDYtNGQ2MC1iMmMxLWY4MjMwOTgyMmU5YyIsImFjY291bnQiOiJhZG1pbiJ9.st" +
                "MyV_h0Z1bljzS_Q_pkUvU91EX-KKybzcyWwgwa560" +
                "MjI3MTIiLCJ1c2VyX25hbWUiOiJhZG1pbiIsInJlYWxfbmFtZSI6ImFkbWluIiwiYXZhd" +
                "GFyIjoiIiwiYXV0aG9yaXRpZXMiOlsiYWRtaW4iXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2" +
                "xlX25hbWUiOiJhZG1pbiIsImxpY2Vuc2UiOiJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQi" +
                "OiIxNDgxNTQ4Njc1NjA2MDQ0Njc0IiwidXNlcl9pZCI6IjE0ODE1NDg2NzkyNjQ3MjcwNDEiLCJyb2" +
                "xlX2lkIjoiMTQ4MTU0ODY3Mzc4MTUyMjQzMyIsInNjb3BlIjpbImFsbCJdLCJuaWNrX25hbWUiOiJhZG" +
                "1pbiIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7InR5cGUiOiJ3ZWIifSwiZXhwIjoxNjQyNDEyMDYyLC" +
                "JkZXB0X2lkIjoiMTQ4MTU0ODY3NTU5NzY1NjA2NiIsImp0aSI6ImFiMmExYmY3LTdjNDYtNGQ2MC1iMm" +
                "MxLWY4MjMwOTgyMmU5YyIsImFjY291bnQiOiJhZG1pbiJ9.stMyV_h0Z1bljzS_Q_pkUvU91EX-KKybz" +
                "cyWwgwa560eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIyMjI3MTIiLCJ1c" +
                "2VyX25hbWUiOiJhZG1pbiIsInJlYWxfbmFtZSI6ImFkbWluIiwiYXZhdGFyIjoiIiwiYXV0aG9yaXRpZX" +
                "MiOlsiYWRtaW4iXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2xlX25hbWUiOiJhZG1pbiIsImxpY2Vuc2UiO" +
                "iJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQiOiIxNDgxNTQ4Njc1NjA2MDQ0Njc0IiwidXNlcl9pZCI" +
                "6IjE0ODE1NDg2NzkyNjQ3MjcwNDEiLCJyb2xlX2lkIjoiMTQ4MTU0ODY3Mzc4MTUyMjQzMyIsInNjb3BlI" +
                "jpbImFsbCJdLCJuaWNrX25hbWUiOiJhZG1pbiIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7InR5cGUiOiJ" +
                "3ZWIifSwiZXhwIjoxNjQyNDEyMDYyLCJkZXB0X2lkIjoiMTQ4MTU0ODY3NTU5NzY1NjA2NiIsImp0aSI6I" +
                "mFiMmExYmY3LTdjNDYtNGQ2MC1iMmMxLWY4MjMwOTgyMmU5YyIsImFjY291bnQiOiJhZG1pbiJ9.st" +
                "MyV_h0Z1bljzS_Q_pkUvU91EX-KKybzcyWwgwa560";


        System.out.println(p1.length());
        String p11 = Rsa.encryptByPrivateKey(p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1, rsaKeys.getPrivateKey());
        System.out.println(p11);
        String p2 = Rsa.decryptByPublicKey(p11, rsaKeys.getPublicKey());
        System.out.println(p2.length());
        System.out.println(p2.equals(p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1 + p1));
    }
}
