我的问题是:我在Java中加密的东西我可以在Java中完美解密,但PHP mcrypt无法解密.我加密的内容mcrypt可以解密mcrypt,但不能用Java 解密.
我想从Java应用程序发送和接收加密数据到PHP页面,所以我需要它兼容.
这是我的...
JAVA ...
public static String crypt(String input, String key){
byte[] crypted = null;
try{
SecretKeySpec skey = new SecretKeySpec(Base64.decodeBase64(key), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skey);
crypted = cipher.doFinal(input.getBytes());
}catch(Exception e){
}
return Base64.encodeBase64String(crypted);
}
public static String decrypt(String input, String key){
byte[] output = null;
try{
SecretKeySpec skey = new SecretKeySpec(Base64.decodeBase64(key), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, skey);
output = cipher.doFinal(Base64.decodeBase64(input));
}catch(Exception e){
}
return new String(output);
}
Run Code Online (Sandbox Code Playgroud)
运行: …
我一直在寻找答案,但无论我使用什么方法,它似乎都没有切断我的字符串末尾的新行字符.
这是我的代码,我试图用来str.replace()摆脱新行字符,因为它似乎是这个问题的标准答案:
process.stdin.on("data", function(data) {
var str;
str = data.toString();
str.replace(/\r?\n|\r/g, " ");
return console.log("user typed: " + str + str + str);
});
Run Code Online (Sandbox Code Playgroud)
我str在控制台输出中重复了三次对象来测试它.这是我的结果:
hi
user typed: hi
hi
hi
Run Code Online (Sandbox Code Playgroud)
如您所见,每个字符之间仍然有新的行字符str.我已经尝试了一些其他参数,str.replace()但似乎没有什么工作可以摆脱新行字符.
我想开始我的第一个应用程序react-native但是当我在命令行"react-native run-android"中写道时,它说:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
Run Code Online (Sandbox Code Playgroud)
有谁知道可能是什么问题?
我BiometricPrompt在应用程序中使用了Android P(API 28)中的新API。(我实际上是在基于此项目的包装器中使用它,以便它也可以在较旧的设备上运行,但这与问题无关。)这在我测试过的所有设备上都运行良好,除了三星S9和脸部解锁。
即使BiometricPrompt当前的普通Android版本仅实现指纹认证,三星似乎也对其进行了扩展以支持Face Unlock。当我在我的应用中触发生物特征认证时,“底页”会弹出一个脸部图标(而不是所有其他设备上显示的指纹图标),并且在屏幕顶部会出现一些文字,显示“未检测到脸部”。(请注意,此处显示的图标是操作系统提供的,而不是我提供的,因此显然是三星的设计。)
根据文档,BiometricPrompt仅onAuthenticationSucceeded当身份验证成功后,才应关闭自身并调用我的方法。根据logcat,看起来好像已经成功了:
I/IFaceDaemonCallback: BpFaceDaemonCallback onAcquired()
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=132] algo_out g=1.785 e_time=0.025 IsLLS=0x0 Ev=7.422 Bv=2.348 ProEv=7.348 Cvgd=1 lux=261, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/FaceHal: face_processFrontImage[614398]
I/FaceServiceWrapper: ss_face_processFrontImage(data_len = 614398, width = 480, height = 640, rotation = 270)
I/NativeFaceService: FaceService::processFrontImage - data_len (614398) width(480) height(640) rotation(270) format(2)
I/NativeFaceService: SEC_FR_SERVICE_AUTHENTICATE
I/sec_fr_engine_qsee: sec_fr_engine_on_authenticate_frame
D/sec_fr_engine_qsee: call QSEECom_send_cmd
I/SS_3A: …Run Code Online (Sandbox Code Playgroud) 我正在使用 Android 数据绑定,虽然事情很简单,但效果很好。然而,一旦我添加了一个BindingAdapter注释,我的项目就停止在 Android Studio 中构建并出现错误Execution failed for task ':app:compileSaferesourceDebugJavaWithJavac',但它没有给我更多细节。gradlew build在命令行上运行显示实际错误是java.lang.ClassNotFoundException: javax.xml.bind.JAXBException. 这是有道理的,因为这台开发机器只安装了 Java 11,没有安装 Java 8。
我找到了这个答案,它说要向 gradle 添加以下依赖项:
implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"
Run Code Online (Sandbox Code Playgroud)
我的问题是我不知道在哪里添加它们。将它们作为implementation依赖项添加到app/build.gradle不起作用,因为 JAXB 是构建工具的依赖项,而不是我的应用程序本身的依赖项。
我也尝试添加它们buildscript.dependencies,但这也不起作用:
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "javax.xml.bind:jaxb-api:2.3.1"
classpath "com.sun.xml.bind:jaxb-core:2.3.0"
classpath "com.sun.xml.bind:jaxb-impl:2.3.1"
classpath "javax.activation:activation:1.1.1"
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将它们添加到buildscript.dependencies项目根build.gradle文件中,但这也无济于事:
buildscript {
repositories { …Run Code Online (Sandbox Code Playgroud) 我在罐子里有一个类的方法,我想用自己的身体交换它.在这种情况下,我只想让方法将"GOT IT"打印到控制台并返回true;
我正在使用系统加载器来加载jar的类.我使用反射使系统类加载器能够通过字节码加载类.这部分似乎工作正常.
我按照这里找到的方法替换示例:asm.ow2.org/current/asm-transformations.pdf.
我的代码如下:
public class Main
{
public static void main(String[] args)
{
URL[] url = new URL[1];
try
{
url[0] = new URL("file:////C://Users//emist//workspace//tmloader//bin//runtime//tmgames.jar");
verifyValidPath(url[0]);
}
catch (Exception ex)
{
System.out.println("URL error");
}
Loader l = new Loader();
l.loadobjection(url);
}
public static void verifyValidPath(URL url) throws FileNotFoundException
{
File filePath = new File(url.getFile());
if (!filePath.exists())
{
throw new FileNotFoundException(filePath.getPath());
}
}
}
class Loader
{
private static final Class[] parameters = new Class[] {URL.class};
public static void addURL(URL …Run Code Online (Sandbox Code Playgroud) 我想要一个非常简单的模态对话框运行.所以按照教程我最终得到这个代码:
BundleConfig:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-1.8.2.min.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-1.8.24.js"));
Run Code Online (Sandbox Code Playgroud)
_布局:
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
</head>
<body>
<div id="body">
@RenderSection("featured", required: false)
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</div>
<footer>
<div class="content-wrapper">
<div class="float-left">
<p>© @DateTime.Now.Year - My ASP.NET MVC Application</p>
</div>
</div>
</footer>
@RenderSection("scripts", required: false)
</body>
Run Code Online (Sandbox Code Playgroud)
和指数:
@section featured {
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<script type="text/javascript"> …Run Code Online (Sandbox Code Playgroud) 我正在使用Vagrant来部署VM以进行开发.其中一个要求是vagrant provision创建一个新用户(在我编写的配置脚本中完成),然后vagrant ssh以该用户身份连接到该框.
我无法弄清楚如何判断盒子是否已经配置.
我看到Vagrant配置代码设置了env[:provision_enabled]这个运行是否应该进行配置,所以我想我可以做这样的事情:
if env[:provision_enabled]
config.ssh.username = "#{data['ssh']['provision_username']}"
else
config.ssh.username = "#{data['ssh']['username']}"
end
Run Code Online (Sandbox Code Playgroud)
这个想法是供应的SSH连接将使用一个连接和SSH连接,其他一切将使用另一个.
但是,env[:provision_enabled]似乎无法访问Vagrantfile.
有没有办法做到这一点?
在我的应用程序中,我实现了一个广播接收器,它捕获com.android.vending.INSTALL_REFERRERAndroid从市场安装应用程序后启动的意图.
我在此处详细了解:http://code.google.com/mobile/analytics/docs/android/#referrals
这个推荐人也会抓住更新吗?换句话说,用户可以使用引荐来源和更新应用程序打开Google Play商店吗?
假设我有一个充满健康记录和ASP.NET MVC应用程序的数据库.假设某人使用URL"/ api/medicalRecords?$ filter = id gt 0"来调用Ajax请求.在我看来,这对SQL注入是开放的 - 就像10 - 15年前一样......
这是否意味着它是通过标准的SQL注入开放,还是依赖于服务器端(我使用IQueryable结果和实体框架4)?
我知道认证机制是必要的 - 但是为了这个问题,假设没有可用的认证机制......
android ×3
java ×2
ado.net ×1
aes ×1
asp.net-mvc ×1
biometrics ×1
bytecode ×1
c# ×1
classloader ×1
encryption ×1
google-play ×1
gradle ×1
java-11 ×1
javascript ×1
jaxb ×1
jquery ×1
jquery-ui ×1
linq ×1
node.js ×1
odata ×1
php ×1
react-native ×1
regex ×1
vagrant ×1