我们有一个项目,其中在启动saml应用程序时会初始化各种算法。启动时,它会引发以下错误(请检查日志):未使用RIPEMD160,HMACRIPEMD160和RIPEMD160。我尝试深入研究RIPEMD160,发现RIPEMD160映射到rt.jar内DigestMethod.java文件中的URL“http://www.w3.org/2001/04/xmlenc#ripemd160”。
但是找不到导致失败的唯一算法的原因是RIPEMD160,带有RSA的RIPEMD160,HMACRIPEMD160而不是其他。
14:28:38.930 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'BlockEncryption' with URI 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc': org.opensaml.xmlsec.algorithm.descriptors.BlockEncryptionDESede
14:28:38.930 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#tripledes-cbc
14:28:38.931 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmldsig-more#md5': org.opensaml.xmlsec.algorithm.descriptors.DigestMD5
14:28:38.931 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#md5
14:28:38.931 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmlenc#ripemd160': org.opensaml.xmlsec.algorithm.descriptors.DigestRIPEMD160
14:28:38.931 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#ripemd160
14:28:38.944 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - AlgorithmDescriptor failed runtime support check: http://www.w3.org/2001/04/xmlenc#ripemd160
java.security.NoSuchAlgorithmException: RIPEMD160 MessageDigest not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.Security.getImpl(Security.java:695)
at java.security.MessageDigest.getInstance(MessageDigest.java:167)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.checkRuntimeSupports(AlgorithmRegistry.java:267)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.index(AlgorithmRegistry.java:203)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.register(AlgorithmRegistry.java:138)
at org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer.init(GlobalAlgorithmRegistryInitializer.java:49)
at org.opensaml.core.config.InitializationService.initialize(InitializationService.java:56)
at com.practicehs.common.IQConnectAuth.SamlHelper.init(SamlHelper.java:111)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.createSamlHelper(SamlAssertionFixture.java:138)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.<init>(SamlAssertionFixture.java:119)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.main(SamlAssertionFixture.java:501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
14:28:38.944 [main] INFO org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmlenc#ripemd160
14:28:38.948 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2000/09/xmldsig#sha1': org.opensaml.xmlsec.algorithm.descriptors.DigestSHA1
14:28:38.948 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2000/09/xmldsig#sha1
14:28:38.949 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmldsig-more#sha224': org.opensaml.xmlsec.algorithm.descriptors.DigestSHA224
14:28:38.949 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#sha224
14:28:38.949 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmlenc#sha256': org.opensaml.xmlsec.algorithm.descriptors.DigestSHA256
14:28:38.949 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#sha256
14:28:38.950 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmldsig-more#sha384': org.opensaml.xmlsec.algorithm.descriptors.DigestSHA384
14:28:38.950 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#sha384
14:28:38.950 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'MessageDigest' with URI 'http://www.w3.org/2001/04/xmlenc#sha512': org.opensaml.xmlsec.algorithm.descriptors.DigestSHA512
14:28:38.950 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#sha512
14:28:38.951 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-md5': org.opensaml.xmlsec.algorithm.descriptors.HMACMD5
14:28:38.951 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-md5
14:28:38.951 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160': org.opensaml.xmlsec.algorithm.descriptors.HMACRIPEMD160
14:28:38.951 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160
14:28:38.951 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - AlgorithmDescriptor failed runtime support check: http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160
java.security.NoSuchAlgorithmException: Algorithm HMACRIPEMD160 not available
at javax.crypto.Mac.getInstance(Mac.java:181)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.checkRuntimeSupports(AlgorithmRegistry.java:263)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.index(AlgorithmRegistry.java:203)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.register(AlgorithmRegistry.java:138)
at org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer.init(GlobalAlgorithmRegistryInitializer.java:49)
at org.opensaml.core.config.InitializationService.initialize(InitializationService.java:56)
at com.practicehs.common.IQConnectAuth.SamlHelper.init(SamlHelper.java:111)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.createSamlHelper(SamlAssertionFixture.java:138)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.<init>(SamlAssertionFixture.java:119)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.main(SamlAssertionFixture.java:501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
14:28:38.952 [main] INFO org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2000/09/xmldsig#hmac-sha1': org.opensaml.xmlsec.algorithm.descriptors.HMACSHA1
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2000/09/xmldsig#hmac-sha1
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha224': org.opensaml.xmlsec.algorithm.descriptors.HMACSHA224
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-sha224
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256': org.opensaml.xmlsec.algorithm.descriptors.HMACSHA256
14:28:38.952 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-sha256
14:28:38.953 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha384': org.opensaml.xmlsec.algorithm.descriptors.HMACSHA384
14:28:38.953 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-sha384
14:28:38.953 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Mac' with URI 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha512': org.opensaml.xmlsec.algorithm.descriptors.HMACSHA512
14:28:38.953 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#hmac-sha512
14:28:38.954 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'KeyTransport' with URI 'http://www.w3.org/2001/04/xmlenc#rsa-1_5': org.opensaml.xmlsec.algorithm.descriptors.KeyTransportRSA15
14:28:38.954 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#rsa-1_5
14:28:38.954 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'KeyTransport' with URI 'http://www.w3.org/2009/xmlenc11#rsa-oaep': org.opensaml.xmlsec.algorithm.descriptors.KeyTransportRSAOAEP
14:28:38.954 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2009/xmlenc11#rsa-oaep
14:28:38.955 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'KeyTransport' with URI 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p': org.opensaml.xmlsec.algorithm.descriptors.KeyTransportRSAOAEPMGF1P
14:28:38.955 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
14:28:38.955 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2000/09/xmldsig#dsa-sha1': org.opensaml.xmlsec.algorithm.descriptors.SignatureDSASHA1
14:28:38.955 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2000/09/xmldsig#dsa-sha1
14:28:38.956 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2009/xmldsig11#dsa-sha256': org.opensaml.xmlsec.algorithm.descriptors.SignatureDSASHA256
14:28:38.956 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2009/xmldsig11#dsa-sha256
14:28:38.956 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1': org.opensaml.xmlsec.algorithm.descriptors.SignatureECDSASHA1
14:28:38.956 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1
14:28:38.958 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha224': org.opensaml.xmlsec.algorithm.descriptors.SignatureECDSASHA224
14:28:38.958 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha224
14:28:38.959 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256': org.opensaml.xmlsec.algorithm.descriptors.SignatureECDSASHA256
14:28:38.959 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256
14:28:38.960 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384': org.opensaml.xmlsec.algorithm.descriptors.SignatureECDSASHA384
14:28:38.960 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384
14:28:38.960 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512': org.opensaml.xmlsec.algorithm.descriptors.SignatureECDSASHA512
14:28:38.960 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512
14:28:38.961 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#rsa-md5': org.opensaml.xmlsec.algorithm.descriptors.SignatureRSAMD5
14:28:38.961 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#rsa-md5
14:28:38.961 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160': org.opensaml.xmlsec.algorithm.descriptors.SignatureRSARIPEMD160
14:28:38.961 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160
14:28:38.961 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - AlgorithmDescriptor failed runtime support check: http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160
java.security.NoSuchAlgorithmException: RIPEMD160withRSA Signature not available
at java.security.Signature.getInstance(Signature.java:229)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.checkRuntimeSupports(AlgorithmRegistry.java:259)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.index(AlgorithmRegistry.java:203)
at org.opensaml.xmlsec.algorithm.AlgorithmRegistry.register(AlgorithmRegistry.java:138)
at org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer.init(GlobalAlgorithmRegistryInitializer.java:49)
at org.opensaml.core.config.InitializationService.initialize(InitializationService.java:56)
at com.practicehs.common.IQConnectAuth.SamlHelper.init(SamlHelper.java:111)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.createSamlHelper(SamlAssertionFixture.java:138)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.<init>(SamlAssertionFixture.java:119)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at com.practicehs.common.IQConnectAuth.SamlAssertionFixture.main(SamlAssertionFixture.java:501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
14:28:38.963 [main] INFO org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160
14:28:38.963 [main] DEBUG org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer - Registering AlgorithmDescriptor of type 'Signature' with URI 'http://www.w3.org/2000/09/xmldsig#rsa-sha1': org.opensaml.xmlsec.algorithm.descriptors.SignatureRSASHA1
14:28:38.963 [main] DEBUG org.opensaml.xmlsec.algorithm.AlgorithmRegistry - Registering algorithm descriptor with URI: http://www.w3.org/2000/09/xmldsig#rsa-sha1
最佳答案
在我的项目中添加了bouncycastle,效果很好。
在pom中添加以下依赖项:
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.60</version>
</dependency>
并在main方法中添加了以下行:
Security.addProvider(new BouncyCastleProvider());
关于java - java.security.NoSuchAlgorithmException:RIPEMD160 MessageDigest不可用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54331463/