Tongsuo-Project/tongsuo-java-sdk

4.19.91-25.6.al7.x86_64 环境无法运行demo

Opened this issue · 0 comments

运行SM4 demo出现以下错误:

java.security.NoSuchAlgorithmException: No such algorithm: SM4/GCM/NoPadding
at javax.crypto.Cipher.getInstance(Cipher.java:691)
at javax.crypto.Cipher.getInstance(Cipher.java:599)
at com.alibaba.encdb.example.main(example.java:36)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254)
at java.lang.Thread.run(Thread.java:750)

我尝试用provider.getServices(); 方法打印TongsuoProvider支持的所有算法,发现为以下内容,并不包含商密系列:
Name: Tongsuo_Security_Provider
Information:
Tongsuo JCA/JCE/JSSE Provider, supporting RFC 8998
Service Type: SSLContext Algorithm SSL
Service Type: SSLContext Algorithm TLS
Service Type: SSLContext Algorithm TLSv1
Service Type: SSLContext Algorithm TLSv1.1
Service Type: SSLContext Algorithm TLSv1.2
Service Type: SSLContext Algorithm TLSv1.3
Service Type: SSLContext Algorithm Default
Service Type: TrustManagerFactory Algorithm PKIX
Service Type: AlgorithmParameters Algorithm AES
Service Type: AlgorithmParameters Algorithm ChaCha20
Service Type: AlgorithmParameters Algorithm DESEDE
Service Type: AlgorithmParameters Algorithm GCM
Service Type: AlgorithmParameters Algorithm OAEP
Service Type: AlgorithmParameters Algorithm PSS
Service Type: AlgorithmParameters Algorithm EC
Service Type: MessageDigest Algorithm SHA-1
Service Type: MessageDigest Algorithm SHA-224
Service Type: MessageDigest Algorithm SHA-256
Service Type: MessageDigest Algorithm SHA-384
Service Type: MessageDigest Algorithm SHA-512
Service Type: MessageDigest Algorithm MD5
Service Type: KeyGenerator Algorithm ARC4
Service Type: KeyGenerator Algorithm AES
Service Type: KeyGenerator Algorithm ChaCha20
Service Type: KeyGenerator Algorithm DESEDE
Service Type: KeyGenerator Algorithm HmacMD5
Service Type: KeyGenerator Algorithm HmacSHA1
Service Type: KeyGenerator Algorithm HmacSHA224
Service Type: KeyGenerator Algorithm HmacSHA256
Service Type: KeyGenerator Algorithm HmacSHA384
Service Type: KeyGenerator Algorithm HmacSHA512
Service Type: KeyPairGenerator Algorithm RSA
Service Type: KeyPairGenerator Algorithm EC
Service Type: KeyPairGenerator Algorithm XDH
Service Type: KeyFactory Algorithm RSA
Service Type: KeyFactory Algorithm EC
Service Type: KeyFactory Algorithm XDH
Service Type: SecretKeyFactory Algorithm DESEDE
Service Type: SecretKeyFactory Algorithm SCRYPT
Service Type: KeyAgreement Algorithm ECDH
Service Type: KeyAgreement Algorithm XDH
Service Type: Signature Algorithm MD5withRSA
Service Type: Signature Algorithm SHA1withRSA
Service Type: Signature Algorithm SHA224withRSA
Service Type: Signature Algorithm SHA256withRSA
Service Type: Signature Algorithm SHA384withRSA
Service Type: Signature Algorithm SHA512withRSA
Service Type: Signature Algorithm NONEwithRSA
Service Type: Signature Algorithm NONEwithECDSA
Service Type: Signature Algorithm SHA1withECDSA
Service Type: Signature Algorithm SHA224withECDSA
Service Type: Signature Algorithm SHA256withECDSA
Service Type: Signature Algorithm SHA384withECDSA
Service Type: Signature Algorithm SHA512withECDSA
Service Type: Signature Algorithm SHA1withRSA/PSS
Service Type: Signature Algorithm SHA224withRSA/PSS
Service Type: Signature Algorithm SHA256withRSA/PSS
Service Type: Signature Algorithm SHA384withRSA/PSS
Service Type: Signature Algorithm SHA512withRSA/PSS
Service Type: SecureRandom Algorithm SHA1PRNG
Service Type: Cipher Algorithm RSA/ECB/NoPadding
Service Type: Cipher Algorithm RSA/ECB/PKCS1Padding
Service Type: Cipher Algorithm RSA/ECB/OAEPPadding
Service Type: Cipher Algorithm RSA/ECB/OAEPWithSHA-1AndMGF1Padding
Service Type: Cipher Algorithm RSA/ECB/OAEPWithSHA-224AndMGF1Padding
Service Type: Cipher Algorithm RSA/ECB/OAEPWithSHA-256AndMGF1Padding
Service Type: Cipher Algorithm RSA/ECB/OAEPWithSHA-384AndMGF1Padding
Service Type: Cipher Algorithm RSA/ECB/OAEPWithSHA-512AndMGF1Padding
Service Type: Cipher Algorithm AES/ECB/NoPadding
Service Type: Cipher Algorithm AES/ECB/PKCS5Padding
Service Type: Cipher Algorithm AES/CBC/NoPadding
Service Type: Cipher Algorithm AES/CBC/PKCS5Padding
Service Type: Cipher Algorithm AES/CTR/NoPadding
Service Type: Cipher Algorithm AES_128/ECB/NoPadding
Service Type: Cipher Algorithm AES_128/ECB/PKCS5Padding
Service Type: Cipher Algorithm AES_128/CBC/NoPadding
Service Type: Cipher Algorithm AES_128/CBC/PKCS5Padding
Service Type: Cipher Algorithm AES_256/ECB/NoPadding
Service Type: Cipher Algorithm AES_256/ECB/PKCS5Padding
Service Type: Cipher Algorithm AES_256/CBC/NoPadding
Service Type: Cipher Algorithm AES_256/CBC/PKCS5Padding
Service Type: Cipher Algorithm DESEDE/CBC/NoPadding
Service Type: Cipher Algorithm DESEDE/CBC/PKCS5Padding
Service Type: Cipher Algorithm ARC4
Service Type: Cipher Algorithm AES/GCM/NoPadding
Service Type: Cipher Algorithm AES_128/GCM/NoPadding
Service Type: Cipher Algorithm AES_256/GCM/NoPadding
Service Type: Cipher Algorithm AES/GCM-SIV/NoPadding
Service Type: Cipher Algorithm AES_128/GCM-SIV/NoPadding
Service Type: Cipher Algorithm AES_256/GCM-SIV/NoPadding
Service Type: Cipher Algorithm ChaCha20
Service Type: Cipher Algorithm ChaCha20/Poly1305/NoPadding
Service Type: Mac Algorithm HmacMD5
Service Type: Mac Algorithm HmacSHA1
Service Type: Mac Algorithm HmacSHA224
Service Type: Mac Algorithm HmacSHA256
Service Type: Mac Algorithm HmacSHA384
Service Type: Mac Algorithm HmacSHA512
Service Type: Mac Algorithm AESCMAC
Service Type: CertificateFactory Algorithm X509