我在Windows 7中启用了FIPS兼容模式,但现在我的代码无法编译,并出现以下错误:
Source file 'whatever.cs' could not be opened ('This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.')
Run Code Online (Sandbox Code Playgroud)
我正在使用SHA1(散列)和TripleDes(加密)加密.我也尝试过SHA512和AES(256位密钥).
我不能让项目继续构建,但我需要编译它以使用FIPS兼容算法.
我正在尝试在我的java应用程序上启用FIPS 180-3.FIPS 180-3只允许使用5个安全[哈希](http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf),MD5不是其中之一.因此,我试图以编程方式从Sun提供程序中删除MD5算法.这是示例代码.
public static void main(String[] args) throws Exception {
Security.removeProvider("SUN");
Sun sun = new Sun();
sun.remove("MessageDigest.MD5"); //Comment and it will work !!!
Security.addProvider(sun);
Cipher ciph = Cipher.getInstance("AES");
}
Run Code Online (Sandbox Code Playgroud)
但这是抛出以下异常.如果你评论"sun.remove(.."该程序工作正常.如果我删除MD2,而不是MD5,那么它也可以正常工作.
对我来说,看起来jre libs正在使用MD5进行签名,但我检查了jre/lib/ext/sunjce_provider.jar签名者及其使用sha1.
知道为什么我的代码失败了这个错误?
TestRemoveMD5.main中的javax.crypto.Cipher.getInstance(DashoA13*..)中的线程"main"java.lang.ExceptionInInitializerError中的异常(TestRemoveMD5.java:20)
引起:java.lang.SecurityException:无法在javax.crypto.SunJCE_b上为受信任的CA设置证书.(DashoA13*..)... 3更多
引起:java.lang.SecurityException:签名类已经被javax.crypto.SunJCE_b中的javax.crypto.SunJCE_b.d(DashoA13*..)篡改了javax.crypto.SunJCE_b $ 1 .run(DashoA13*..)at java.security.AccessController.doPrivileged(Native Method)... 4更多
我使用http://opensslfoundation.com/testing/validation-2.0/platforms/ios/中的说明交叉编译了armv7的FIPS.
我在交叉编译对fips的openssl依赖时遇到了困难.
我在终端中遇到以下错误.
/usr/local/ssl/fips-2.0/bin/fipsld: line 185: ./openssl: Bad CPU type in executable
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1
Run Code Online (Sandbox Code Playgroud)
这是因为"/ apps"文件夹下的openssl可执行文件是体系结构armv7.由于我是交叉编译openssl,我只需要libssl和libcrypto与架构armv7,其他中间可执行文件应该使用i386架构.
任何有关设置环境变量的帮助都表示赞赏.
我的项目需要保持所有数据加密,因此MSMQ也需要加密.但是从文章(https://msdn.microsoft.com/en-us/library/ms704178(v=vs.85).aspx)中可以看出来自私有队列的消息默认存储在...\MSMQ\Storage中\ p000000x.mq文件.
配置专用队列时,将其隐私级别设置为"Body",当我将加密消息发送到此队列时,然后在文本查看器中打开...\MSMQ\Storage\p000000x.mq文件(我使用远程管理器十六进制编辑器) ),我看到消息的纯文本.它没有加密.要发送消息我使用下一个代码:
message.UseEncryption = true;
message.EncryptionAlgorithm = EncryptionAlgorithm.Rc2;
Run Code Online (Sandbox Code Playgroud)
尽管指定了消息加密,但消息...\MSMQ\Storage\p000000x.mq保持畅通.见下图.
所以我的问题是:是否有一些内置工具可以在...\MSMQ\Storage\p000000x.mq文件中将邮件加密到驱动器上?或者我需要在发送到队列之前加密消息体,然后,当从队列中查看时,我需要解密它吗?
非常感谢!
我希望获得一些有关为 nginx 启用 openssl fips 模式的指导。到目前为止,我按照 openssl 指南在 openssl 上启用 fips 模式。
该部分效果很好:
# /usr/local/openssl/bin/openssl md5 /usr/local/openssl/bin/openssl
Error setting digest md5
139805371958952:error:060A80A3:digital envelope
routines:FIPS_DIGESTINIT:disabled for fips:fips_md.c:180:
# cat /proc/sys/crypto/fips_enabled
1
Run Code Online (Sandbox Code Playgroud)
对于 nginx,我首先尝试使用此自定义 openssl 构建 nginx:
/nginx-1.12.2/configure --with-http_ssl_module --with-openssl=/usr/local/openssl --with-ld-opt="-L/usr/local/openssl/lib"
Run Code Online (Sandbox Code Playgroud)
然而,这失败了,因为 /usr/local/openssl 是自定义 openssl 的“安装”位置,而不是源树。
所以我更改了 --with-openssl 选项以使用 openssl 源树:
/nginx-1.12.2/configure --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.0.2n/ --with-ld-opt="-L/usr/local/openssl/lib"
Run Code Online (Sandbox Code Playgroud)
这有效,我可以安装 nginx,但我不认为在 nginx 配置期间传递了支持 fips 模式的正确 openssl 编译选项。
当我打印 nginx 信息时:
nginx -V:
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with …Run Code Online (Sandbox Code Playgroud) 我担心的是,垃圾收集器管理的加密密钥和秘密可以在内存中复制和移动而不会出现零化.
作为一种可能的解决方案,它足以:
public class Key {
private char[] key;
// ...
protected void finalize() throws Throwable {
try {
for(int k = 0; k < key.length; k++) {
key[k] = '\0';
}
} catch (Exception e) {
//...
} finally {
super.finalize();
}
}
// ...
}
Run Code Online (Sandbox Code Playgroud)
编辑:请注意,我的问题不仅涉及对象的官方(引用)副本的归零,而且还涉及垃圾收集器可能已经制作的任何陈旧副本,同时它会为了空间和速度效率而改变内存.
最简单的例子是标记和扫描GC,其中对象被标记为"引用",然后所有这些对象被复制到另一个区域.其余的都是垃圾,所以他们被收集.当副本发生时,可能会留下垃圾收集器不再管理的剩余密钥数据(因为"官方"数据位于新区域中).
对此进行的试金石是,如果您在加密模块中使用密钥,将密钥归零,然后检查整个JVM进程空间,则不应该找到该密钥.
我正在使用.net 3.5,我正在尝试使我的应用程序符合FIPS.我不使用任何非FIPS算法,但是当我在生产服务器上运行它时仍然会出现此错误.
此实现不是Windows平台FIPS验证的加密算法的一部分.
这是我检查过的算法列表,我确信我没有使用它们.
我怎样才能找到问题的确切位置或其他想法?
我的公司在 .Net Framework 3.5 中使用 ASP.NET 创建了项目,并使用 Windows Web Server 2008 r2 来托管该项目。
在 Web 服务器中,我们启用了“系统加密:使用符合 FIPS 的算法进行加密、散列和签名”的设置
之后,应用程序不会运行。它显示以下错误
Parser Error Message: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
[InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.]
System.Security.Cryptography.RijndaelManaged..ctor() +7715396
System.Web.Configuration.MachineKeySection.ConfigureEncryptionObject() +232
System.Web.Configuration.MachineKeySection.EnsureConfig() +156
System.Web.Configuration.MachineKeySection.GetEncodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32& length) +37
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +166
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) …Run Code Online (Sandbox Code Playgroud) 我正在尝试连接到 SFTP 服务器。它是使用FIPS模式的加密服务器。我能够通过 WinSCP、FileZilla 和 bash sftp 命令连接并执行文件传输,没有任何问题。
但是,我无法使用RCurl(R 版本=3.3.2,RCurl 版本=1.95-4.10,Windows 10)从 R 访问相同的 SFTP 。这是我的代码的样子以及正在生成的错误消息:
RCurl::ftpUpload(what="path/to/my/local/file.ext",
to = "sftp://my.eftp.server:portNumber/path/to/my/file.ext",
userpwd = "user:password",
.opts=curlOptions(verbose=TRUE))
Run Code Online (Sandbox Code Playgroud)
错误信息是:
* Trying ###.###.###.##...
* Connected to my.eftp.server (###.###.###.##) port ## (#0)
* Failure establishing ssh session
* Closing connection 0
Error in function (type, msg, asError = TRUE) :
Failure establishing ssh session
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很棒。我参考了以下内容,但没有成功: sftp with R - sftp not a protocol with RCurl、 Using RCurl with SFTP 和 …
我正在尝试在 Python 的 ssl 模块中实现 FIPS_mode 和 FIPS_mode_set 函数,因为默认情况下它们不存在。由于各种使用原因,Python 3.4的补丁已经提交并被拒绝。
使用该补丁作为灵感,我进行了一些修改并在ssl.py 中添加了以下代码:
try:
from _ssl import FIPS_mode, FIPS_mode_set
except ImportError:
pass
Run Code Online (Sandbox Code Playgroud)
_ssl.c 中的以下代码:
#define EXPORT_FIPSMODE_FUNCS
#ifdef EXPORT_FIPSMODE_FUNCS
static PyObject *
_ssl_FIPS_mode_impl(PyObject *module) {
return PyLong_FromLong(FIPS_mode());
}
static PyObject *
_ssl_FIPS_mode_set_impl(PyObject *module, int n) {
if (FIPS_mode_set(n) == 0) {
_setSSLError(ERR_error_string(ERR_get_error(), NULL) , 0, __FILE__, __LINE__);
return NULL;
}
Py_RETURN_NONE;
}
#endif //EXPORT_FIPSMODE_FUNCS
/* List of functions exported by this module. */
static PyMethodDef PySSL_methods[] = …Run Code Online (Sandbox Code Playgroud)