RSA/ECB/OAEPWITHSHA256ANDMGF1PADDING
和
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING
是不同的别名,但两者都指的是相同的算法,因此从这个意义上讲它们没有区别。
问题在于您正在使用
PKCS#11
(加密令牌接口)来加密数据。根据Java
PKCS#11
参考文档:
引用如下:
The Sun PKCS#11 provider, in contrast to most other providers, does not implement cryptographic algorithms itself. Instead, it acts as a bridge between the Java JCA and JCE APIs and the native PKCS#11 cryptographic API, translating the calls and conventions between the two. This means that Java applications calling standard JCA and JCE APIs can, without modification, take advantage of algorithms offered by the underlying PKCS#11 implementations, such as, for example,
Cryptographic Smartcards, Hardware cryptographic accelerators, and High performance software implementations. Note that Java SE only facilitates accessing native PKCS#11 implementations, it does not itself include a native PKCS#11 implementation. However, cryptographic devices such as Smartcards and hardware accelerators often come with software that includes a PKCS#11 implementation, which you need to install and configure according to manufacturer's instructions.
总之,如果您正在使用
PKCS#11
,则算法的使用取决于供应商的本地实现(在Windows上为
.dll
,在Linux上为
.so
…),有时还取决于特定的程序连接器,因此:请检查您在两台计算机上是否使用相同的驱动程序/程序版本来使用您的
PKCS#11
令牌,并且两者都正确安装,因为可能其中一个存在错误,这将导致您无法正确使用
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING
。
希望这可以帮助到您,