我想用java中的证书签名文件内容.
有了terminal和openssl,我可以这样做:
openssl smime -sign -in nosign.mobileconfig -out signed.mobileconfig -signer server.crt -inkey server.key -certfile cacert.crt -outform der -nodetach
Run Code Online (Sandbox Code Playgroud)
server.crt和.key是要签名的文件,我想我理解cacert.crt是嵌入在out内容中的.
最后,我有一个签名和信任的文件.
在Java中,我不能使用openssl(不想启动openssl命令)所以,我必须用lib签名.
要做到这一点,我使用Bouncy Castle(版本1.53)
这是我的代码:
byte[] profile = ...; // I can have it also in String
// the certificate in -certfile
FileInputStream inputStream = new FileInputStream("src/main/resources/cacert.crt");
byte[] caCertificate = ByteStreams.toByteArray(inputStream);
// the certificate to sign : server.crt, embedded in p12
X509Certificate serverCertificate = (X509Certificate) this.keyStore.getCertificate("1");
// Private key is the server.key
ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(this.privateKey);
CMSSignedDataGenerator generator = new …Run Code Online (Sandbox Code Playgroud) 我试图通过事件从 web 视图执行 android 中的代码。所以我用 JavascriptInterface 实现了这个好方法,但由于我有一个 iOS 应用程序,我想使用相同的方法。那么这是否可以在 Android 上使用消息处理程序(只是一个简单的 JS 事件)而不是接口的桥接?我也尝试过另一种方式:在 iOS 上以与 Android 相同的方式构建桥梁,但它不适用于 WKWebview(但这是另一个问题)谢谢!
我在附件视图中有一个带有 UISwitch 的 UITableviewCell,它在运行时正确显示,但是一旦我旋转设备,开关就不再位于正确的位置。

我可以使用约束而不使用accessoryView,但我想我可以使用这个字段..有人有想法吗?
谢谢 !
编辑:这是 Interface Builder 中的配置:

编辑2:我使用了自定义单元格:

对默认属性进行初始化:
self.textLabel.font = [UIFont preferredDynamicFontForTextStyle:UIFontTextStyleBody fontSize:16.0];
self.backgroundColor = self.contentView.backgroundColor;
self.textLabel.text = item.title;
self.selectedImage = item.imageSelected;
self.unselectedImage = item.image;
self.imageView.image = self.unselectedImage;
// if I do it programmatically
self.accessoryView = [[UISwitch alloc] init];
Run Code Online (Sandbox Code Playgroud)
我根本不设置约束,因为我使用默认属性..
android ×1
bouncycastle ×1
certificate ×1
ios ×1
java ×1
javascript ×1
objective-c ×1
security ×1
sign ×1
uitableview ×1
webkit ×1