remove unused files

This commit is contained in:
ayunami2000 2022-01-23 21:28:09 -05:00
parent 4bc59831da
commit 7a8e60a706
18 changed files with 1007 additions and 1574 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,32 +0,0 @@
package me.ayunami2000.ayuncraft;
import me.ayunami2000.ayuncraft.java.security.PublicKey;
import java.security.Key;
public class ModifiablePublicKey implements PublicKey, Key {
private String algorithm;
private String format;
private byte[] encoded;
@Override
public String getAlgorithm() {
return algorithm;
}
@Override
public String getFormat() {
return format;
}
@Override
public byte[] getEncoded() {
return encoded;
}
public ModifiablePublicKey(String algo,String form,byte[] data){
algorithm=algo;
format=form;
encoded=data;
}
}

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security;
public interface Key {
public String getAlgorithm();
public String getFormat();
public byte[] getEncoded();
}

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security;
import me.ayunami2000.ayuncraft.javax.security.auth.Destroyable;
public interface PrivateKey extends Key, Destroyable {
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security;
public interface PublicKey extends Key {
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security.spec;
public interface KeySpec { }

View File

@ -1,6 +0,0 @@
package me.ayunami2000.ayuncraft.javax.crypto;
import me.ayunami2000.ayuncraft.java.security.Key;
public interface SecretKey extends Key {
}

View File

@ -1,80 +0,0 @@
package me.ayunami2000.ayuncraft.javax.crypto.spec;
import me.ayunami2000.ayuncraft.java.security.spec.KeySpec;
import me.ayunami2000.ayuncraft.javax.crypto.SecretKey;
public class SecretKeySpec implements KeySpec, SecretKey {
private String algorithm;
private byte[] key;
public String getAlgorithm() {
return this.algorithm;
}
public String getFormat() {
return "RAW";
}
public byte[] getEncoded() {
byte[] tmp = new byte[this.key.length];
System.arraycopy(this.key, 0, tmp, 0, tmp.length);
return tmp;
}
public int hashCode() {
int code = this.algorithm.toUpperCase().hashCode();
for(int i = 0; i != this.key.length; ++i) {
code ^= this.key[i] << 8 * (i % 4);
}
return code;
}
public boolean equals(Object obj) {
if (obj != null && obj instanceof SecretKeySpec) {
SecretKeySpec spec = (SecretKeySpec)obj;
if (!this.algorithm.equalsIgnoreCase(spec.algorithm)) {
return false;
} else if (this.key.length != spec.key.length) {
return false;
} else {
for(int i = 0; i != this.key.length; ++i) {
if (this.key[i] != spec.key[i]) {
return false;
}
}
return true;
}
} else {
return false;
}
}
public SecretKeySpec(byte[] key, String algorithm) {
if (key == null) {
throw new IllegalArgumentException("null key passed");
} else if (algorithm == null) {
throw new IllegalArgumentException("null algorithm passed");
} else {
this.key = new byte[key.length];
System.arraycopy(key, 0, this.key, 0, key.length);
this.algorithm = algorithm;
}
}
public SecretKeySpec(byte[] key, int offset, int len, String algorithm) {
if (key == null) {
throw new IllegalArgumentException("Null key passed");
} else if (key.length - offset < len) {
throw new IllegalArgumentException("Bad offset/len");
} else if (algorithm == null) {
throw new IllegalArgumentException("Null algorithm string passed");
} else {
this.key = new byte[len];
System.arraycopy(key, offset, this.key, 0, len);
this.algorithm = algorithm;
}
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.javax.security.auth;
public class DestroyFailedException extends Exception {
private static final long serialVersionUID = -7790152857282749162L;
public DestroyFailedException() {
super();
}
public DestroyFailedException(String msg) {
super(msg);
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.javax.security.auth;
public interface Destroyable {
public default void destroy() throws DestroyFailedException {
throw new DestroyFailedException();
}
public default boolean isDestroyed() {
return false;
}
}

View File

@ -3,7 +3,6 @@ package net.minecraft.src;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;
import me.ayunami2000.ayuncraft.java.security.PublicKey;
import java.util.*; import java.util.*;
import me.ayunami2000.ayuncraft.CryptManager; import me.ayunami2000.ayuncraft.CryptManager;
@ -12,8 +11,6 @@ import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.WebsocketNetworkManager; import net.lax1dude.eaglercraft.WebsocketNetworkManager;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import me.ayunami2000.ayuncraft.javax.crypto.SecretKey;
public class NetClientHandler extends NetHandler { public class NetClientHandler extends NetHandler {
/** True if kicked or disconnected from the server. */ /** True if kicked or disconnected from the server. */

View File

@ -63,13 +63,17 @@ public class CryptManager
return new SecretKeySpec(decryptData(par0PrivateKey, par1ArrayOfByte), "AES"); return new SecretKeySpec(decryptData(par0PrivateKey, par1ArrayOfByte), "AES");
} }
///* @JSBody(params = {"pubkey", "mod", "indata"}, script =
@JSBody(params = {"pubkey", "mod", "indata"}, script = "var rsa=new RSAKey();rsa.setPublic(b64tohex(mod),b64tohex(pubkey));var res=hex2b64(rsa.encrypt(b64tohex(indata)));return res;") "var rsa=new RSAKey();" +
"rsa.setPublic(b64tohex(mod),b64tohex(pubkey));" +
"return hex2b64(rsa.encrypt(b64tohex(indata)));")
private static native String encryptDataNative(String pubkey, String mod, String indata); private static native String encryptDataNative(String pubkey, String mod, String indata);
@JSBody(params = {"privkey", "mod", "indata"}, script = "var rsa=new RSAKey();rsa.setPrivate(b64tohex(mod),b64tohex(privkey));var res=hex2b64(rsa.decrypt(b64tohex(indata)));return res;") @JSBody(params = {"privkey", "mod", "indata"}, script =
"var rsa=new RSAKey();" +
"rsa.setPrivate(b64tohex(mod),b64tohex(privkey));" +
"return hex2b64(rsa.decrypt(b64tohex(indata)));")
private static native String decryptDataNative(String pubkey, String mod, String indata); private static native String decryptDataNative(String pubkey, String mod, String indata);
//*/
/** /**
* Encrypt byte[] data with RSA public key * Encrypt byte[] data with RSA public key

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security;
import me.ayunami2000.ayuncraft.javax.security.auth.Destroyable;
public interface PrivateKey extends Key, Destroyable {
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security;
public interface PublicKey extends Key {
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security.spec;
public interface AlgorithmParameterSpec { }

View File

@ -1,91 +0,0 @@
/*
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.java.security.spec;
import java.math.BigInteger;
public class RSAPublicKeySpec implements KeySpec {
private final BigInteger modulus;
private final BigInteger publicExponent;
private final AlgorithmParameterSpec params;
/**
* Creates a new RSAPublicKeySpec.
*
* @param modulus the modulus
* @param publicExponent the public exponent
*/
public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent) {
this(modulus, publicExponent, null);
}
/**
* Creates a new RSAPublicKeySpec with additional key parameters.
*
* @param modulus the modulus
* @param publicExponent the public exponent
* @param params the parameters associated with this key, may be null
* @since 8
*/
public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent,
AlgorithmParameterSpec params) {
this.modulus = modulus;
this.publicExponent = publicExponent;
this.params = params;
}
/**
* Returns the modulus.
*
* @return the modulus
*/
public BigInteger getModulus() {
return this.modulus;
}
/**
* Returns the public exponent.
*
* @return the public exponent
*/
public BigInteger getPublicExponent() {
return this.publicExponent;
}
/**
* Returns the parameters associated with this key, may be null if not
* present.
*
* @return the parameters associated with this key
* @since 8
*/
public AlgorithmParameterSpec getParams() {
return this.params;
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.javax.security.auth;
public class DestroyFailedException extends Exception {
private static final long serialVersionUID = -7790152857282749162L;
public DestroyFailedException() {
super();
}
public DestroyFailedException(String msg) {
super(msg);
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package me.ayunami2000.ayuncraft.javax.security.auth;
public interface Destroyable {
public default void destroy() throws DestroyFailedException {
throw new DestroyFailedException();
}
public default boolean isDestroyed() {
return false;
}
}