有谁知道NIST SP 800-56A级联密钥派生函数/ CONCAT KDF(最好用Java)的任何现有实现?
密钥推导函数记录在NIST出版物的第5.8.1节中:使用离散对数密码学的双智能密钥建立方案的建议
链接到这里:http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf
微软的CNG 在这里有一个实现,但是如果你比较微软实现的功能,与NIST SP 800-56A中记录的参数相比,它们不相符,并且微软的实现是无法使用的.我试图用C++实现一个示例程序,但是我无法匹配这些参数.
有人能够尝试实现它或知道任何现有的实现吗?
我正在寻找一种能够证明为什么它对NIST规范是准确的实现.我已经看到了一些实现,我觉得它们对NIST规范不准确(缺少参数,无效的逻辑流程等).
如果您可以自己实现它,我总是很乐意分享我自己的源代码进行辩论.谢谢!这对开源社区是一个很好的贡献!
编辑:
感谢@Rasmus Faber,我终于可以结束这个问题,并希望回答其他人对我的同样问题.
这是我根据@Rasmus Faber和我的原始代码编辑的代码:
ConcatKeyDerivationFunction.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* Implementation of Concatenation Key Derivation Function<br/>
* http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf
*
*/
public class ConcatKeyDerivationFunction {
private static final long MAX_HASH_INPUTLEN = Long.MAX_VALUE;
private static final long UNSIGNED_INT_MAX_VALUE = 4294967295L;
private static MessageDigest md;
public ConcatKeyDerivationFunction(String hashAlg) throws NoSuchAlgorithmException {
md = MessageDigest.getInstance(hashAlg);
}
public …Run Code Online (Sandbox Code Playgroud) 我试图运行AWS SDK for Java附带的DynamoDB示例.我是用eclipse做的,并将aws-java-sdk-1.3.2.jar文件添加到项目的构建路径中.编译当然很好,但我得到一个名为的运行时异常NoClassDefFoundError.我知道这意味着该类在编译时存在但在运行时无法找到.我尝试将jar文件添加到env变量 - 没有帮助.我也检查过,在其他项目中使用其他外部jar文件没有问题.Windows和Linux上的问题相同.
帮助任何人?
谢谢,本.
堆栈跟踪:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.amazonaws.services.dynamodb.AmazonDynamoDBClient.<clinit>(AmazonDynamoDBClient.java:62)
at AmazonDynamoDBSample.init(AmazonDynamoDBSample.java:62)
at AmazonDynamoDBSample.main(AmazonDynamoDBSample.java:67)
Run Code Online (Sandbox Code Playgroud) 我观察到<item name="android:textSize">14sp</item>在/res/values/styles.xml 中设置为20sp将导致输入元素在小于5"的设备上正常显示.似乎减小文本大小并没有减小输入框的大小.这是假设要正常吗?
嗨,您好,
我在Android项目中遇到输入元素大小的问题.输入元素在大小<5"的设备上显得更大,但在我的大型设备上显得正常.
以下屏幕截图说明了这一点.知道可能是什么原因?
嗨,您好,
我目前面临着一个奇怪的问题,我的Android项目中的表单元素的大小跨越不同的模拟器.由于这是我第一次创建移动应用程序,如果这是一个"功能",请随时启发我,而不是一个错误.
在Nexus 7布局预览中,表单元素按预期显示:

但是,在Galaxy Nexus布局预览中,表单元素看起来比预期的要大,这是不可取的:

我尝试了很多方法,但一直无法解决这个问题.所有小于5英寸屏幕尺寸的设备都会出现此问题.
这是我的布局XML文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/register_link"
style="@style/FormFont.Label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="3dp"
android:clickable="true"
android:onClick="onClickRegisterLink"
android:text="@string/register_link_text" />
<RelativeLayout
android:id="@+id/layout_layout_form"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_above="@+id/register_link"
android:gravity="center" >
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/layout_form"
android:layout_alignRight="@+id/layout_form"
android:layout_marginBottom="50dp"
android:contentDescription="@string/logo_description"
android:src="@drawable/logo" />
<RelativeLayout
android:id="@+id/layout_form"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/logo"
android:gravity="center" >
<TextView
android:id="@+id/label_username"
style="@style/FormFont.Label"
android:layout_alignBottom="@+id/input_username"
android:layout_alignLeft="@+id/label_password"
android:layout_alignRight="@+id/label_password"
android:layout_alignTop="@+id/input_username"
android:layout_toLeftOf="@+id/input_username"
android:gravity="right"
android:text="@string/label_username" /> …Run Code Online (Sandbox Code Playgroud) 亲爱的用户我正在使用apache lucene进行索引和搜索.我必须索引存储在计算机本地光盘上的html文件.我必须对html文件的文件名和内容进行索引.我能够将文件名存储在lucene索引中但不能存储html文件内容,这些内容不仅应该索引数据,而且应该整个页面包含图像链接和url以及如何从索引文件中访问内容以进行索引我正在使用以下代码:
File indexDir = new File(indexpath);
File dataDir = new File(datapath);
String suffix = ".htm";
IndexWriter indexWriter = new IndexWriter(
FSDirectory.open(indexDir),
new SimpleAnalyzer(),
true,
IndexWriter.MaxFieldLength.LIMITED);
indexWriter.setUseCompoundFile(false);
indexDirectory(indexWriter, dataDir, suffix);
numIndexed = indexWriter.maxDoc();
indexWriter.optimize();
indexWriter.close();
private void indexDirectory(IndexWriter indexWriter, File dataDir, String suffix) throws IOException {
try {
for (File f : dataDir.listFiles()) {
if (f.isDirectory()) {
indexDirectory(indexWriter, f, suffix);
} else {
indexFileWithIndexWriter(indexWriter, f, suffix);
}
}
} catch (Exception ex) {
System.out.println("exception 2 is" + ex);
}
} …Run Code Online (Sandbox Code Playgroud)