小编Hor*_*rax的帖子

将字节数组转换为密钥

我一直在尝试将字节数组转换为原始的SecretKey,但我没有更多的想法了.最有希望的尝试就是这个:

byte[] encodedKey     = Base64.decode(stringKey);
SecretKey originalKey = SecretKeySpec(encodedKey, 0, encodedKey.length, "AES")
Run Code Online (Sandbox Code Playgroud)

在这里找到:将密钥转换为字符串和反之亦然

我正在使用import javax.crypto.spec.SecretKeySpec,因此应该正确使用SecretKeySpec的构造函数,至少参考http://docs.oracle.com/javase/1.5.0/docs/api/javax/ crypto/spec/SecretKeySpec.html.

尽管如此,我总是得到"方法SecretKeySpec未定义... [类名]" - 我只是没有得到.

我猜它只是一些小错误,但我无法弄明白.有人可以帮帮我吗?

java byte secret-key

27
推荐指数
1
解决办法
3万
查看次数

如何为nodejs设置节点路径(Ubuntu)

我正在尝试设置nodejs来访问postgres数据库.到目前为止我所做的是以下内容(https://gist.github.com/579814):

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
Run Code Online (Sandbox Code Playgroud)

然后

git clone git://github.com/isaacs/npm.git
make
make install
Run Code Online (Sandbox Code Playgroud)

到现在为止还挺好.但是,当我尝试安装postgres驱动程序时

npm install pg
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

node-waf配置构建|| 真正

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking …
Run Code Online (Sandbox Code Playgroud)

postgresql node.js

7
推荐指数
2
解决办法
5万
查看次数

标签 统计

byte ×1

java ×1

node.js ×1

postgresql ×1

secret-key ×1