我有一个X.509证书,其中包含一组带有以下IMPLICIT [0]标记的数据:
A0 81 C6 (value)...
Run Code Online (Sandbox Code Playgroud)
我从标准文件中摘录了这些内容:
IMPLICIT [0]标记不用于DER编码,而是使用EXPLICIT SET OF标记.也就是说,必须包含EXPLICIT SET OF标记的DER编码,而不是IMPLICIT [0]标记的DER编码以及值的长度和内容八位字节.
我已经做了很多搜索,但我无法弄清楚标准要求的确切内容.我正在寻找一些澄清.
编辑:这是我遵循的标准:http://tools.ietf.org/html/rfc3852
我正在尝试验证X.509签名,我需要计算消息摘要来执行此操作.此证书包含SignerInfo类型中的可选SignedAttributes.我已经对签名内容进行了哈希处理,并验证了SignedAttributes中的消息摘要是否正确.该标准规定,如果存在SignedAttributes,则应对其进行散列和加密以创建证书的签名.该标准还说,应该按照原始问题中的讨论更改SignedAttributes的标记.
这是SignerInfo的Asn.1语法:
SignerInfo ::= SEQUENCE {
version CMSVersion,
sid SignerIdentifier,
digestAlgorithm DigestAlgorithmIdentifier,
signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
signatureAlgorithm SignatureAlgorithmIdentifier,
signature SignatureValue,
unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
SignerIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier }
SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
Attribute ::= SEQUENCE {
attrType OBJECT IDENTIFIER,
attrValues SET OF …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何制作AES加密的公钥/私钥.我希望能够像这样使用它:
byte[] BytesToEncrypt = { 0x01, 0x02, 0x03, 0x04, 0x05 };
byte[] PublicKey;
byte[] PrivateKey;
byte[] EncryptedBytes;
byte[] UnencryptedBytes;
PrivateKey = CreatePrivateKey();
PublicKey = CreatePublicKey(PrivateKey);
EncryptedBytes = EncryptBytes(PrivateKey);
// This line should return unencrypted bytes
UnencryptedBytes = UnencryptBytes(EncryptedBytes, PrivateKey);
// This line should also return the unencrypted bytes
UnencryptedBytes = UnencryptBytes(EncryptedBytes, PublicKey);
Run Code Online (Sandbox Code Playgroud)
我该如何实现这样的东西?我见过公共/私有加密,但我见过的所有例子似乎都使用RSA加密.我想使用AES.这可能吗?
我正在使用tomcat 6,spring mvc 3.0.0和spring security 3.0.0,并且由于我在数据库中存储的密码是sha1哈希,我不能使用摘要式身份验证(文档的第9.2.1节说明了).出于这个原因,我需要通过https进行身份验证.
由于潜在的处理开销,我希望尽可能多地保持常规http流量.有没有办法让spring使用https来获取未经身份验证的请求,然后在完成身份验证后使用http?我认为这是通过某种类型的ChannelProcessingFilter来完成的,但我对这些细节感到难过.
这是我目前的application-security.xml文件:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http use-expressions="true">
<intercept-url pattern="/**" access="isAuthenticated()" />
<http-basic />
</http>
<authentication-manager>
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder hash="sha"/>
</authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailsService"
class="path.to.myUserDetailsServiceImpl">
</beans:bean>
</beans:beans>
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助.
我正在寻找一种安全的方法来加密和解密Visual Studio项目中的字符串(在C#中).我发现有原生的DES类,但它不够安全.你有什么建议吗?
更新: 那么,问题是:加密/解密字符串的最安全的方法是什么,没有太多的麻烦(也就是说必须安装外部工具等等.外部库虽然很好).在哪里放秘密"密钥"(正在编译代码中的值足够安全吗?).
更新#2 如果我使用类似此代码的内容将加密字符串保存在配置文件中:
using System.Security.Cryptography;
using System.Security;
byte[] encrypted = ProtectedData.Protect(StrToByteArray("my secret text"), null, DataProtectionScope.LocalMachine);
byte[] derypted = ProtectedData.Unprotect(encrypted , null, DataProtectionScope.LocalMachine);
Run Code Online (Sandbox Code Playgroud)
这足够安全吗?我想用"LocalMachine"参数而不是"User"参数,有人可以在.net中编写一个应用程序,将它放在机器上并执行它来解密加密的字符串.因此,如果我希望它更安全,我将不得不为每个用户配置不同的配置文件?我理解正确吗?
我在VC++中创建了一个GUI应用程序,现在我想对数据进行AES128加密,我正在写它.
任何人都可以让我知道如何在VC++中做到这一点.
告诉我加密XML文件的最简单方法.它是一个用于某些配置的文件,不希望人们乱用它.安全性不是问题,因为它是一种私有工具.
在构建Web应用程序时,我想知道我需要多长时间的秘密(多少位)作为加密中的密钥 - 以及我是否可以在键盘上捣乱随机字符序列或者我是否需要一些特殊软件为我生成一些东西?
(即从ssh-keygen之类的东西窃取私有RSA)
更新:我manly将在PHP的mcrypt库中使用此密钥,但我也对c ++选项感兴趣(两者都在linux上).
我知道,我知道,类似的问题已经被问到了数百万和数十亿次,但由于大多数人都有不同的味道,我得到了自己的一个.
目前我正在开发一个旨在全国各地推出的网站,因此需要对用户系统进行某种保护.
我最近一直在阅读很多关于密码加密,散列,腌制......你说出来的名字,但在阅读了很多文章之后,我感到很困惑.
有人说简单的SHA512加密对于密码是足够的,其他人说无论你做什么都必须使用"盐",然后有人说你应该建立一个全新的密码加密机器,因为这样没有人能够得到它.
现在我正在使用hash_hmac();SHA512,加密码获取随机SHA1盐和最后一部分,定义随机md5(); 键.对于我们大多数人来说,它听起来很安全,但是它呢?
我最近在这里看到,bcrypt();(现在称为crypt();Blowfish哈希)是最安全的方式.在阅读了关于crypt();和相关内容的PHP手册之后,我很困惑.
基本上,问题是,我是否会hash_hmac();击败Blowfished crypt();,反之亦然?
还有一个,也许有更安全的密码散列选项?
我正在尝试运行一个简单的加密/解密程序.我得到一个填充异常.必须隐藏一些我不知道的东西.我基本上加密了一个字符串,将其写入文件,将其读回并解密.原始加密阵列解密没有问题.我将原始加密数组与从文件中读回的数组进行了比较,它们与我所看到的相同.文件中的缓冲区不起作用,因此必须有区别.我不知道该怎么办.
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.*;
public class sample
{
private static String _algo = "AES";
private static byte[] _key = new byte[16];
public static byte[] encrypt (String val) throws Exception
{
Key key = new SecretKeySpec (_key, _algo);
Cipher c = Cipher.getInstance (_algo);
c.init (Cipher.ENCRYPT_MODE, key);
byte[] encode = c.doFinal (val.getBytes());
return encode;
}
public static String decrypt (byte[] val) throws Exception
{
Key key = new SecretKeySpec (_key, _algo);
Cipher c = Cipher.getInstance …Run Code Online (Sandbox Code Playgroud) encryption ×10
c# ×3
cryptography ×3
security ×3
.net ×2
aes ×1
codeigniter ×1
encoding ×1
hash ×1
java ×1
mfc ×1
passwords ×1
php ×1
tags ×1
tomcat ×1
visual-c++ ×1
x509 ×1
xml ×1