python3.6.5安装from Crypto.Cipher import AES 插件 5C

winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26): error C2061: 语法
错误: 标识符“intmax_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2061: 语法
错误: 标识符“rem”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2059: 语法
错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28): error C2059: 语法
错误:“}”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2061: 语法
错误: 标识符“imaxdiv_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2059: 语法
错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(40): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2146: 语法
错误: 缺少“)”(在标识符“_Number”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2061: 语法
错误: 标识符“_Number”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2059: 语法
错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(42): error C2059: 语法
错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(45): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2146: 语法
错误: 缺少“)”(在标识符“_Numerator”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2061: 语法
错误: 标识符“_Numerator”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: 语法
错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: 语法
错误:“,”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(48): error C2059: 语法
错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(50): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(56): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(63): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(69): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(76): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(82): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(89): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(95): error C2143: 语法
错误: 缺少“{”(在“__cdecl”的前面)
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\
\14.13.26128\bin\HostX86\x64\cl.exe' failed with exit status 2

----------------------------------------

Command "d:\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\ADMINI~1\AppDa
ta\Local\Temp\pip-install-f11kwaa6\pycrypto\setup.py';f=getattr(tokenize, 'open', open)(__file__);
code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C
:\Users\ADMINI~1\AppData\Local\Temp\pip-record-0_lm9jbu\install-record.txt --single-version-externally-
managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-f11kwaa
6\pycrypto\

2个回答

安装
pip install pycroptydome图片说明

试着去装装 anaconda,这个应用很广泛的,里面有很多的编程语言,当然包括python

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
请问python加密解密文件时 无法还原文件应如何操作.
![图片说明](https://img-ask.csdn.net/upload/201912/23/1577067661_768299.png)![图片说明](https://img-ask.csdn.net/upload/201912/23/1577067679_492429.png) 源文件1.txt 经过加密解密 得到2.txt 2.txt中的内容无法还原 以下为代码正文 ``` # -*- coding: utf-8 -*- #AES-demo import base64 from Crypto.Cipher import AES #import struct #采用AES对称加密算法 # str不是16的倍数那就补足为16的倍数 def add_to_16(value): while len(value) % 16 != 0: value += '\0' return str.encode(value) # 返回bytes #加密方法 def encrypt_oracle(): # 秘钥 key = '7771777' # 待加密文本 text = open('1.txt', 'rb').read() print(text) print(type(text)) print('10') text = str(text) print(text) print(type(text)) print('11') #text = 'abc123def456' # 初始化加密器 aes = AES.new(add_to_16(key), AES.MODE_ECB) print(aes) print(type(aes)) print('12') #先进行aes加密 encrypt_aes = aes.encrypt(add_to_16(text)) print(encrypt_aes) print(type(encrypt_aes)) print('13') #用base64转成字符串形式 encrypted_text = str(base64.encodebytes(encrypt_aes), encoding='utf-8') # 执行加密并转码返回bytes print(encrypted_text) print(type(encrypted_text)) print('14') logbat = open('a.aa', 'w') logbat.write(encrypted_text) logbat.close() #解密方法 def decrypt_oralce(): # 秘钥 key = '7771777' # 密文 text = str(open('a.aa', 'r').read()) print(text) print(type(text)) print('21') #text = 'qR/TQk4INsWeXdMSbCDDdA==' # 初始化加密器 aes = AES.new(add_to_16(key), AES.MODE_ECB) print(aes) print(type(aes)) print('22') #优先逆向解密base64成bytes base64_decrypted = base64.decodebytes(text.encode(encoding='utf-8')) print(base64_decrypted) print(type(base64_decrypted)) print('23') #执行解密密并转码返回str decrypted_text = str(aes.decrypt(base64_decrypted),encoding='gbk').replace('\0','') print(decrypted_text) print(type(decrypted_text)) print('24') decrypted_text = bytes(decrypted_text,encoding='gbk') print(decrypted_text) print(type(decrypted_text)) print('25') logbat = open('2.txt', 'wb') logbat.write(decrypted_text) logbat.close() if __name__ == '__main__': encrypt_oracle() decrypt_oralce() ```
pythonAES加密使用CBC模式与JAVA的CBC加密结果不同!求解!
JAVA的AES加密示例 import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.nio.charset.StandardCharsets; import java.util.Base64; public class AesUtil { private static final String KEY_ALGORITHM = "AES"; private static final String DEFAULT_CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding"; public static String encrypt(String strKey, String strIn) throws Exception { SecretKeySpec skeySpec = getKey(strKey); Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM); IvParameterSpec iv = new IvParameterSpec(strKey.getBytes()); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); byte[] encrypted = cipher.doFinal(strIn.getBytes()); String aesResult = new String(Base64.getEncoder().encode(encrypted), StandardCharsets.UTF_8); return aesResult.replace("/", "_"); } private static SecretKeySpec getKey(String strKey) throws Exception { byte[] arrBTmp = strKey.getBytes(); byte[] arrB = new byte[16]; for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) { arrB[i] = arrBTmp[i]; } return new SecretKeySpec(arrB, KEY_ALGORITHM); } } 这个是我用python写的AES加密 from Crypto.Cipher import AES import base64 from time import sleep class aescrypt: def __init__(self, key, model, iv, encode_): self.encode_ = encode_ self.model = {'ECB': AES.MODE_ECB, 'CBC': AES.MODE_CBC}[model] self.key = self.add_16(key) if model == 'ECB': self.aes = AES.new(self.key, self.model) # 创建一个aes对象 elif model == 'CBC': self.aes = AES.new(self.key, self.model, iv, segment_size=128) # 创建一个aes对象 elif model == 'CFB': self.aes = AES.new(self.key, self.model) # 这里的密钥长度必须是16、24或32 def add_16(self, par): par = par.encode(self.encode_) while len(par) % 16 != 0: par += b'n' return par def aesencrypt(self, text): # 此处text传入的值为cleartext text = self.add_16(text) print(text) self.encrypt_text = self.aes.encrypt(text) return base64.encodebytes(self.encrypt_text).decode().strip() def aesdecrypt(self, text): text = base64.decodebytes(text.encode(self.encode_)) self.decrypt_text = self.aes.decrypt(text) return self.decrypt_text.decode(self.encode_).strip('\0') if __name__ == '__main__': keyy = input("输入密钥:") cleartext = input("输入明文:") pr = aescrypt(keyy, 'CBC', IV, 'utf8'),此处为加密模式及内容,IV en_text = pr.aesencrypt(cleartext) print('密文:', en_text) print('明文:', pr.aesdecrypt(en_text)) 这里我写了两个加密模式,上述代码已经换成同样的CBC模式加密
DES解密问题:通过密钥、偏移量加密正常,解密出错?
DES解密问题:通过密钥、偏移量加密正常,解密出错:Given final block not properly padded.那位大神遇到过这种问题。在线等。 # 问题 ``` package com.whiteink.pms.util; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import javax.crypto.spec.IvParameterSpec; import java.security.Key; import java.util.Base64; public class DESUtil { static String key = "693207DB8148FBC9D8410179"; static String iv = "20190225"; static String encoding = "gb2312"; static String data = "{\"parkCode\":\"1\",\"plateNo\":\"京A11113\"}"; /** * <一句话功能描述>:加密 * <功能详细描述>: 将明文加密 * * @Param: key 密钥 * @Param keyiv 自定义偏移量(8字节) * @Param data 明文 * @Return: byte[] */ public static String des3EncodeCBC(byte[] key, byte[] keyiv, byte[] data) throws Exception { Key deskey = null; DESedeKeySpec spec = new DESedeKeySpec(key); SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede"); deskey = keyfactory.generateSecret(spec); Cipher cipher = Cipher.getInstance("desede" + "/CBC/PKCS5Padding"); IvParameterSpec ips = new IvParameterSpec(keyiv); cipher.init(Cipher.ENCRYPT_MODE, deskey, ips); return Base64.getEncoder().encodeToString(cipher.doFinal(data)); } /** * <一句话功能描述>:解密 * <功能详细描述>: 将密文转成明文 * * @Param: key 密钥 * @Param keyiv 偏移量 * @Param data 明文 * @Return: byte[] */ public static String des3DecodeCBC(byte[] key, byte[] keyiv, byte[] data) throws Exception { System.out.println(new String(data)); DESedeKeySpec dks = new DESedeKeySpec(key); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("desede"); SecretKey securekey = keyFactory.generateSecret(dks); // 解密 Cipher cipher = Cipher.getInstance("desede" + "/CBC/PKCS5Padding"); IvParameterSpec ivp = new IvParameterSpec(keyiv); cipher.init(Cipher.DECRYPT_MODE, securekey, ivp); return Base64.getEncoder().encodeToString(cipher.doFinal(data)); } public static void main(String[] args) throws Exception{ String data = "{\"parkCode\":\"1\",\"plateNo\":\"京A11113\"}"; String mw = des3EncodeCBC(key.getBytes(), iv.getBytes(), data.getBytes("GB2312")); System.out.println(des3DecodeCBC(key.getBytes(), iv.getBytes(), mw.getBytes())); } } ``` # 解决方案 ===============解决方案=============== ``` package com.whiteink.pms.util; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.util.Base64; public class DESUtil { private static String encoding = "gb2312"; private static String data = "{\"parkCode\":\"1\",\"plateNo\":\"京A11113\"}"; public static String encrypt(String key, String iv, String data) throws Exception { SecretKey secretKey = new SecretKeySpec(key.getBytes(), "desede"); Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding"); IvParameterSpec ips = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.ENCRYPT_MODE, secretKey, ips); byte[] encryptData = cipher.doFinal(data.getBytes(encoding)); return Base64.getEncoder().encodeToString(encryptData); } public static void main(String[] args) throws Exception { String key = "693207DB8148FBC9D8410179"; String iv = "20190225"; String encryption = encrypt(key, iv, data); System.out.println(encryption); String decryption = decrypt(key, iv, encryption); System.out.println(decryption); } public static String decrypt(String key, String iv, String data) throws Exception { SecretKey secretKey = new SecretKeySpec(key.getBytes(), "desede"); Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding"); IvParameterSpec ips = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.DECRYPT_MODE, secretKey, ips); byte[] decryptData = cipher.doFinal(Base64.getDecoder().decode(data.getBytes(encoding))); return new String(decryptData, "GB2312"); } } ```
Shiro认证产生的 java.security.InvalidKeyException: Invalid AES key length: 58 bytes
这个错误是咋回事呢? org.apache.shiro.crypto.CryptoException: Unable to init cipher instance. at org.apache.shiro.crypto.JcaCipherService.init(JcaCipherService.java:495) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.crypto.JcaCipherService.initNewCipher(JcaCipherService.java:598) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:444) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.crypto.JcaCipherService.encrypt(JcaCipherService.java:324) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.crypto.JcaCipherService.encrypt(JcaCipherService.java:313) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.AbstractRememberMeManager.encrypt(AbstractRememberMeManager.java:473) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.AbstractRememberMeManager.convertPrincipalsToBytes(AbstractRememberMeManager.java:362) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.AbstractRememberMeManager.rememberIdentity(AbstractRememberMeManager.java:346) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.AbstractRememberMeManager.rememberIdentity(AbstractRememberMeManager.java:321) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.AbstractRememberMeManager.onSuccessfulLogin(AbstractRememberMeManager.java:297) ~[shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.DefaultSecurityManager.rememberMeSuccessfulLogin(DefaultSecurityManager.java:206) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.DefaultSecurityManager.onSuccessfulLogin(DefaultSecurityManager.java:291) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:285) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.authc.AuthenticatingFilter.executeLogin(AuthenticatingFilter.java:53) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied(FormAuthenticationFilter.java:154) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied(AccessControlFilter.java:133) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.AccessControlFilter.onPreHandle(AccessControlFilter.java:162) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued(PathMatchingFilter.java:203) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.filter.PathMatchingFilter.preHandle(PathMatchingFilter.java:178) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:131) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-all-1.2.3.jar:1.2.3] at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-all-1.2.3.jar:1.2.3] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.53] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.53] at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180) [spring-orm-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.53] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.53] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.53] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.53] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.53] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.53] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:7.0.53] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.53] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.53] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) [catalina.jar:7.0.53] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.53] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.53] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) [tomcat-coyote.jar:7.0.53] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.53] at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441) [tomcat-coyote.jar:7.0.53] at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430) [tomcat-coyote.jar:7.0.53] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51] Caused by: java.security.InvalidKeyException: Invalid AES key length: 58 bytes at com.sun.crypto.provider.AESCipher.engineGetKeySize(AESCipher.java:372) ~[sunjce_provider.jar:1.7.0_51] at javax.crypto.Cipher.passCryptoPermCheck(Cipher.java:1052) ~[na:1.7.0_51] at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1023) ~[na:1.7.0_51] at javax.crypto.Cipher.implInit(Cipher.java:790) ~[na:1.7.0_51] at javax.crypto.Cipher.chooseProvider(Cipher.java:849) ~[na:1.7.0_51] at javax.crypto.Cipher.init(Cipher.java:1348) ~[na:1.7.0_51] at javax.crypto.Cipher.init(Cipher.java:1282) ~[na:1.7.0_51] at org.apache.shiro.crypto.JcaCipherService.init(JcaCipherService.java:488) ~[shiro-all-1.2.3.jar:1.2.3] ... 56 common frames omitted
为什么在使用catalyst 时候一直有提示错误ImportError: cannot import name 'run_algorithm'?
如题: 以下为我的环境: py 3.6 aiodns==1.1.1 aiohttp==3.5.4 alabaster==0.7.12 alembic==0.9.7 appnope==0.1.0 asn1crypto==0.24.0 astroid==2.2.5 async-timeout==3.0.1 attrdict==2.0.1 attrs==19.1.0 Babel==2.6.0 backcall==0.1.0 bcolz==1.2.1 bleach==3.1.0 boto3==1.5.27 botocore==1.8.50 Bottleneck==1.2.1 cchardet==2.1.1 ccxt==1.17.94 certifi==2019.3.9 cffi==1.12.3 chardet==3.0.4 click==6.7 cloudpickle==1.0.0 contextlib2==0.5.5 cryptography==2.6.1 cycler==0.10.0 cyordereddict==1.0.0 Cython==0.27.3 cytoolz==0.9.0.1 decorator==4.4.0 defusedxml==0.6.0 docutils==0.14 empyrical==0.2.2 enigma-catalyst==0.5.21 entrypoints==0.3 eth-abi==1.3.0 eth-account==0.2.3 eth-hash==0.2.0 eth-keyfile==0.5.1 eth-keys==0.2.2 eth-rlp==0.1.2 eth-typing==2.1.0 eth-utils==1.6.0 hexbytes==0.1.0 idna==2.8 idna-ssl==1.1.0 imagesize==1.1.0 inflection==0.3.1 intervaltree==2.1.0 ipykernel==5.1.0 ipython==7.5.0 ipython-genutils==0.2.0 isort==4.3.19 jedi==0.13.3 Jinja2==2.10.1 jmespath==0.9.4 jsonschema==3.0.1 jupyter-client==5.2.4 jupyter-core==4.4.0 keyring==18.0.0 kiwisolver==1.1.0 lazy-object-proxy==1.4.1 Logbook==0.12.5 lru-dict==1.1.6 lxml==4.3.3 Mako==1.0.7 MarkupSafe==1.1.1 matplotlib==3.1.0 mccabe==0.6.1 mistune==0.8.4 mkl-fft==1.0.12 mkl-random==1.0.2 more-itertools==7.0.0 multidict==4.5.2 multipledispatch==0.4.9 nbconvert==5.5.0 nbformat==4.4.0 networkx==2.1 numexpr==2.6.4 numpy==1.16.0 numpydoc==0.9.1 packaging==19.0 pandas==0.24.2 pandas-datareader==0.6.0 pandocfilters==1.4.2 parsimonious==0.8.1 parso==0.4.0 patsy==0.5.1 pexpect==4.7.0 pickleshare==0.7.5 prompt-toolkit==2.0.9 psutil==5.6.2 ptyprocess==0.6.0 pycares==3.0.0 pycodestyle==2.5.0 pycparser==2.19 pycryptodome==3.8.2 pyflakes==2.1.1 Pygments==2.4.0 pylint==2.3.1 pyOpenSSL==19.0.0 pyparsing==2.4.0 pyrsistent==0.14.11 PySocks==1.7.0 python-dateutil==2.8.0 python-editor==1.0.4 pytz==2019.1 pyzmq==18.0.0 QtAwesome==0.5.7 qtconsole==4.5.1 QtPy==1.7.1 Quandl==3.4.5 redo==2.0.1 requests==2.21.0 requests-file==1.4.3 requests-ftp==0.3.1 requests-toolbelt==0.8.0 rlp==1.1.0 rope==0.14.0 s3transfer==0.1.13 scipy==1.2.1 six==1.12.0 snowballstemmer==1.2.1 sortedcontainers==1.5.9 Sphinx==2.0.1 sphinxcontrib-applehelp==1.0.1 sphinxcontrib-devhelp==1.0.1 sphinxcontrib-htmlhelp==1.0.2 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.2 sphinxcontrib-serializinghtml==1.1.3 spyder==3.3.4 spyder-kernels==0.4.4 SQLAlchemy==1.2.2 statsmodels==0.9.0 tables==3.4.2 testpath==0.4.2 toolz==0.9.0 tornado==6.0.2 traitlets==4.3.2 typed-ast==1.3.4 typing-extensions==3.7.2 urllib3==1.24.3 wcwidth==0.1.7 web3==4.4.1 webencodings==0.5.1 websockets==5.0.1 wrapt==1.11.1 wurlitzer==1.0.2 yarl==1.1.0 在运行catalyst 的时候会提示: runfile('/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency/trading.py', wdir='/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency') Traceback (most recent call last): File "<ipython-input-10-5dde7acc5e52>", line 1, in <module> runfile('/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency/trading.py', wdir='/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency') File "/Users/mac/miniconda3/envs/catalyst/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile execfile(filename, namespace) File "/Users/mac/miniconda3/envs/catalyst/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency/trading.py", line 6, in <module> from catalyst import run_algorithm File "/Users/mac/Desktop/UPF/Master Thesis/py/crypocurrency/catalyst.py", line 1, in <module> from catalyst import run_algorithm ImportError: cannot import name 'run_algorithm' 我在网上找了很久的解决方案但是都没有一个能解决到的。 会不会是因为在安装catalyst的时候就已经出了这个问题所导致的? 以下为我在安装的时候发生的错误。 请各位大神帮帮忙! ERROR: Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. Note: you may need to restart the kernel to use updated packages.
使用java spi机制给javax.crypto.Cipher中的加密方式起一个别名。
比如使用这种加密方式 Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); 我可以通过Cipher cipher = Cipher.getInstance("RSA/ECB/Test");进行调用,返回相同的对象。不知道各位有没有好的思路呀。
Python出错问题,有没有大神给说说
from Crypto.Cipher import AES from binascii import b2a_hex, a2b_hex class prpcrypt(): def __init__(self, key): self.key = key self.mode = AES.MODE_CBC # 加密函数,如果text不是16的倍数【加密文本text必须为16的倍数!】,那就补足为16的倍数 def encrypt(self, text): cryptor = AES.new(self.key, self.mode, self.key) text = text.encode("utf-8") # 这里密钥key 长度必须为16(AES-128)、24(AES-192)、或32(AES-256)Bytes 长度.目前AES-128足够用 length = 16 count = len(text) add = length - (count % length) text = text + (b'\0' * add) self.ciphertext = cryptor.encrypt(text) # 因为AES加密时候得到的字符串不一定是ascii字符集的,输出到终端或者保存时候可能存在问题 # 所以这里统一把加密后的字符串转化为16进制字符串 return b2a_hex(self.ciphertext).decode("ASCII") # 解密后,去掉补足的空格用strip() 去掉 def decrypt(self, text): cryptor = AES.new(self.key, self.mode, self.key) plain_text = cryptor.decrypt(a2b_hex(text)) return plain_text.rstrip(b'\0').decode("utf-8") if __name__ == '__main__': pc = prpcrypt('keyskeyskeyskeys') # 初始化密钥 e = pc.encrypt("my book is free") d = pc.decrypt(e) print(e, d) e = pc.encrypt("我是一个粉刷匠") d = pc.decrypt(e) print(e, d) 这是源代码, Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/untitled9/test2.py", line 37, in <module> e = pc.encrypt("my book is free") File "C:/Users/Administrator/PycharmProjects/untitled9/test2.py", line 15, in encrypt cryptor = AES.new(self.key, self.mode, self.key) File "C:\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 200, in new return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs) File "C:\Python34\lib\site-packages\Crypto\Cipher\__init__.py", line 55, in _create_cipher return modes[mode](factory, **kwargs) File "C:\Python34\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 234, in _create_cbc_cipher cipher_state = factory._create_base_cipher(kwargs) File "C:\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 100, in _create_base_cipher result = start_operation(c_uint8_ptr(key), File "C:\Python34\lib\site-packages\Crypto\Util\_raw_api.py", line 151, in c_uint8_ptr raise TypeError("Object type %s cannot be passed to C code" % type(data)) TypeError: Object type <class 'str'> cannot be passed to C code 这是输出的错误信息,我用的Python34,请大神看看是什么错误 ,谢谢
Tensorflow测试训练styleGAN时报错 No OpKernel was registered to support Op 'NcclAllReduce' with these attrs.
在测试官方StyleGAN。 运行官方与训练模型pretrained_example.py generate_figures.py 没有问题。GPU工作正常。 运行train.py时报错 尝试只用单个GPU训练时没有报错。 NcclAllReduce应该跟多GPU通信有关,不太了解。 InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'NcclAllReduce' with these attrs. Registered devices: [CPU,GPU], Registered kernels: <no registered kernels> [[Node: TrainD/SumAcrossGPUs/NcclAllReduce = NcclAllReduce[T=DT_FLOAT, num_devices=2, reduction="sum", shared_name="c112", _device="/device:GPU:0"](GPU0/TrainD_grad/gradients/AddN_160)]] 经过多番google 尝试过 重启 conda install keras-gpu 重新安装tensorflow-gpu==1.10.0(跟官方版本保持一致) ``` …… Building TensorFlow graph... Setting up snapshot image grid... Setting up run dir... Training... Traceback (most recent call last): File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1278, in _do_call return fn(*args) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1263, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'NcclAllReduce' with these attrs. Registered devices: [CPU,GPU], Registered kernels: <no registered kernels> [[Node: TrainD/SumAcrossGPUs/NcclAllReduce = NcclAllReduce[T=DT_FLOAT, num_devices=2, reduction="sum", shared_name="c112", _device="/device:GPU:0"](GPU0/TrainD_grad/gradients/AddN_160)]] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "train.py", line 191, in <module> main() File "train.py", line 186, in main dnnlib.submit_run(**kwargs) File "E:\MachineLearning\stylegan-master\dnnlib\submission\submit.py", line 290, in submit_run run_wrapper(submit_config) File "E:\MachineLearning\stylegan-master\dnnlib\submission\submit.py", line 242, in run_wrapper util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs) File "E:\MachineLearning\stylegan-master\dnnlib\util.py", line 257, in call_func_by_name return func_obj(*args, **kwargs) File "E:\MachineLearning\stylegan-master\training\training_loop.py", line 230, in training_loop tflib.run([D_train_op, Gs_update_op], {lod_in: sched.lod, lrate_in: sched.D_lrate, minibatch_in: sched.minibatch}) File "E:\MachineLearning\stylegan-master\dnnlib\tflib\tfutil.py", line 26, in run return tf.get_default_session().run(*args, **kwargs) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 877, in run run_metadata_ptr) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run feed_dict_tensor, options, run_metadata) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1272, in _do_run run_metadata) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\client\session.py", line 1291, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'NcclAllReduce' with these attrs. Registered devices: [CPU,GPU], Registered kernels: <no registered kernels> [[Node: TrainD/SumAcrossGPUs/NcclAllReduce = NcclAllReduce[T=DT_FLOAT, num_devices=2, reduction="sum", shared_name="c112", _device="/device:GPU:0"](GPU0/TrainD_grad/gradients/AddN_160)]] Caused by op 'TrainD/SumAcrossGPUs/NcclAllReduce', defined at: File "train.py", line 191, in <module> main() File "train.py", line 186, in main dnnlib.submit_run(**kwargs) File "E:\MachineLearning\stylegan-master\dnnlib\submission\submit.py", line 290, in submit_run run_wrapper(submit_config) File "E:\MachineLearning\stylegan-master\dnnlib\submission\submit.py", line 242, in run_wrapper util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs) File "E:\MachineLearning\stylegan-master\dnnlib\util.py", line 257, in call_func_by_name return func_obj(*args, **kwargs) File "E:\MachineLearning\stylegan-master\training\training_loop.py", line 185, in training_loop D_train_op = D_opt.apply_updates() File "E:\MachineLearning\stylegan-master\dnnlib\tflib\optimizer.py", line 135, in apply_updates g = nccl_ops.all_sum(g) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\contrib\nccl\python\ops\nccl_ops.py", line 49, in all_sum return _apply_all_reduce('sum', tensors) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\contrib\nccl\python\ops\nccl_ops.py", line 230, in _apply_all_reduce shared_name=shared_name)) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\contrib\nccl\ops\gen_nccl_ops.py", line 59, in nccl_all_reduce num_devices=num_devices, shared_name=shared_name, name=name) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func return func(*args, **kwargs) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\ops.py", line 3156, in create_op op_def=op_def) File "d:\Users\admin\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\ops.py", line 1718, in __init__ self._traceback = tf_stack.extract_stack() InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'NcclAllReduce' with these attrs. Registered devices: [CPU,GPU], Registered kernels: <no registered kernels> [[Node: TrainD/SumAcrossGPUs/NcclAllReduce = NcclAllReduce[T=DT_FLOAT, num_devices=2, reduction="sum", shared_name="c112", _device="/device:GPU:0"](GPU0/TrainD_grad/gradients/AddN_160)]] ``` ``` #conda list: # Name Version Build Channel _tflow_select 2.1.0 gpu absl-py 0.8.1 pypi_0 pypi alabaster 0.7.12 py36_0 asn1crypto 1.2.0 py36_0 astor 0.8.0 pypi_0 pypi astroid 2.3.2 py36_0 attrs 19.3.0 py_0 babel 2.7.0 py_0 backcall 0.1.0 py36_0 blas 1.0 mkl bleach 3.1.0 py36_0 ca-certificates 2019.10.16 0 certifi 2019.9.11 py36_0 cffi 1.13.1 py36h7a1dbc1_0 chardet 3.0.4 py36_1003 cloudpickle 1.2.2 py_0 colorama 0.4.1 py36_0 cryptography 2.8 py36h7a1dbc1_0 cudatoolkit 9.0 1 cudnn 7.6.4 cuda9.0_0 decorator 4.4.1 py_0 defusedxml 0.6.0 py_0 django 2.2.7 pypi_0 pypi docutils 0.15.2 py36_0 entrypoints 0.3 py36_0 gast 0.3.2 py_0 grpcio 1.25.0 pypi_0 pypi h5py 2.9.0 py36h5e291fa_0 hdf5 1.10.4 h7ebc959_0 icc_rt 2019.0.0 h0cc432a_1 icu 58.2 ha66f8fd_1 idna 2.8 pypi_0 pypi image 1.5.27 pypi_0 pypi imagesize 1.1.0 py36_0 importlib_metadata 0.23 py36_0 intel-openmp 2019.4 245 ipykernel 5.1.3 py36h39e3cac_0 ipython 7.9.0 py36h39e3cac_0 ipython_genutils 0.2.0 py36h3c5d0ee_0 isort 4.3.21 py36_0 jedi 0.15.1 py36_0 jinja2 2.10.3 py_0 jpeg 9b hb83a4c4_2 jsonschema 3.1.1 py36_0 jupyter_client 5.3.4 py36_0 jupyter_core 4.6.1 py36_0 keras-applications 1.0.8 py_0 keras-base 2.2.4 py36_0 keras-gpu 2.2.4 0 keras-preprocessing 1.1.0 py_1 keyring 18.0.0 py36_0 lazy-object-proxy 1.4.3 py36he774522_0 libpng 1.6.37 h2a8f88b_0 libprotobuf 3.9.2 h7bd577a_0 libsodium 1.0.16 h9d3ae62_0 markdown 3.1.1 py36_0 markupsafe 1.1.1 py36he774522_0 mccabe 0.6.1 py36_1 mistune 0.8.4 py36he774522_0 mkl 2019.4 245 mkl-service 2.3.0 py36hb782905_0 mkl_fft 1.0.15 py36h14836fe_0 mkl_random 1.1.0 py36h675688f_0 more-itertools 7.2.0 py36_0 nbconvert 5.6.1 py36_0 nbformat 4.4.0 py36h3a5bc1b_0 numpy 1.17.3 py36h4ceb530_0 numpy-base 1.17.3 py36hc3f5095_0 numpydoc 0.9.1 py_0 openssl 1.1.1d he774522_3 packaging 19.2 py_0 pandoc 2.2.3.2 0 pandocfilters 1.4.2 py36_1 parso 0.5.1 py_0 pickleshare 0.7.5 py36_0 pillow 6.2.1 pypi_0 pypi pip 19.3.1 py36_0 prompt_toolkit 2.0.10 py_0 protobuf 3.10.0 pypi_0 pypi psutil 5.6.3 py36he774522_0 pycodestyle 2.5.0 py36_0 pycparser 2.19 py36_0 pyflakes 2.1.1 py36_0 pygments 2.4.2 py_0 pylint 2.4.3 py36_0 pyopenssl 19.0.0 py36_0 pyparsing 2.4.2 py_0 pyqt 5.9.2 py36h6538335_2 pyreadline 2.1 py36_1 pyrsistent 0.15.4 py36he774522_0 pysocks 1.7.1 py36_0 python 3.6.9 h5500b2f_0 python-dateutil 2.8.1 py_0 pytz 2019.3 py_0 pywin32 223 py36hfa6e2cd_1 pyyaml 5.1.2 py36he774522_0 pyzmq 18.1.0 py36ha925a31_0 qt 5.9.7 vc14h73c81de_0 qtawesome 0.6.0 py_0 qtconsole 4.5.5 py_0 qtpy 1.9.0 py_0 requests 2.22.0 py36_0 rope 0.14.0 py_0 scipy 1.3.1 py36h29ff71c_0 setuptools 39.1.0 pypi_0 pypi sip 4.19.8 py36h6538335_0 six 1.13.0 pypi_0 pypi snowballstemmer 2.0.0 py_0 sphinx 2.2.1 py_0 sphinxcontrib-applehelp 1.0.1 py_0 sphinxcontrib-devhelp 1.0.1 py_0 sphinxcontrib-htmlhelp 1.0.2 py_0 sphinxcontrib-jsmath 1.0.1 py_0 sphinxcontrib-qthelp 1.0.2 py_0 sphinxcontrib-serializinghtml 1.1.3 py_0 spyder 3.3.6 py36_0 spyder-kernels 0.5.2 py36_0 sqlite 3.30.1 he774522_0 sqlparse 0.3.0 pypi_0 pypi tensorboard 1.10.0 py36he025d50_0 tensorflow 1.10.0 gpu_py36h3514669_0 tensorflow-base 1.10.0 gpu_py36h6e53903_0 tensorflow-gpu 1.10.0 pypi_0 pypi termcolor 1.1.0 pypi_0 pypi testpath 0.4.2 py36_0 tornado 6.0.3 py36he774522_0 traitlets 4.3.3 py36_0 typed-ast 1.4.0 py36he774522_0 urllib3 1.25.6 pypi_0 pypi vc 14.1 h0510ff6_4 vs2015_runtime 14.16.27012 hf0eaf9b_0 wcwidth 0.1.7 py36h3d5aa90_0 webencodings 0.5.1 py36_1 werkzeug 0.16.0 py_0 wheel 0.33.6 py36_0 win_inet_pton 1.1.0 py36_0 wincertstore 0.2 py36h7fe50ca_0 wrapt 1.11.2 py36he774522_0 yaml 0.1.7 hc54c509_2 zeromq 4.3.1 h33f27b4_3 zipp 0.6.0 py_0 zlib 1.2.11 h62dcd97_3 ``` 2*RTX2080Ti driver 4.19.67
solr导入大量的抓取的来的PDF,PPT,doc,docx文件报错
Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to read content Processing Document # 305 at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:271) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:424) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:483) at org.apache.solr.handler.dataimport.DataImporter.lambda$runAsync$0(DataImporter.java:466) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to read content Processing Document # 305 at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:417) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:330) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:233) ... 4 more Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to read content Processing Document # 305 at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:69) at org.apache.solr.handler.dataimport.TikaEntityProcessor.nextRow(TikaEntityProcessor.java:171) at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:267) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:476) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:517) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:415) ... 6 more Caused by: org.apache.tika.exception.TikaException: TIKA-198: Illegal IOException from org.apache.tika.parser.pdf.PDFParser@803fe60 at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:286) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143) at org.apache.solr.handler.dataimport.TikaEntityProcessor.nextRow(TikaEntityProcessor.java:165) ... 10 more Caused by: java.io.IOException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptDataAESother(SecurityHandler.java:292) at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:153) at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:454) at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:917) at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:874) at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:794) at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:754) at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:185) at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:220) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1160) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1133) at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:154) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) ... 13 more Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher at com.sun.crypto.provider.CipherCore.prepareInputBuffer(CipherCore.java:1005) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:848) at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446) at javax.crypto.Cipher.doFinal(Cipher.java:2047) at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptDataAESother(SecurityHandler.java:276)
请问这段代码最终得出的getKey()的值是什么
package com.ahtv.application; import android.util.Base64; import java.io.PrintStream; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class CryptAES { public static String jmkey = "VatC3b0zAqpLmAkE"; public static String decrypt(String paramString1, String paramString2) { try { SecretKeySpec localSecretKeySpec = new SecretKeySpec(paramString2.getBytes(), "AES"); Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); localCipher.init(2, localSecretKeySpec); byte[] arrayOfByte2 = localCipher.doFinal(Base64.decode(paramString1, 0)); arrayOfByte1 = arrayOfByte2; } catch (Exception localException) { for (;;) { System.out.println(localException.toString()); byte[] arrayOfByte1 = null; } } return new String(arrayOfByte1); } public static String encrypt(String paramString1, String paramString2) { try { SecretKeySpec localSecretKeySpec = new SecretKeySpec(paramString2.getBytes(), "AES"); Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); localCipher.init(1, localSecretKeySpec); byte[] arrayOfByte2 = localCipher.doFinal(paramString1.getBytes()); arrayOfByte1 = arrayOfByte2; } catch (Exception localException) { for (;;) { System.out.println(localException.toString()); byte[] arrayOfByte1 = null; } } return new String(Base64.encodeToString(arrayOfByte1, 0)); } public static String getKey() { if ((jmkey != null) || (!"".equals(jmkey))) { char[] arrayOfChar1 = jmkey.toCharArray(); char[] arrayOfChar2 = new char[jmkey.length()]; for (int i = 0; i < arrayOfChar1.length; i++) { arrayOfChar2[i] = arrayOfChar1[(-1 + arrayOfChar1.length - i)]; } return new String(arrayOfChar2); } return "EkAmLpqAz0b3CtaV"; } public static void main(String[] paramArrayOfString) { System.out.println(getKey()); } }
SNIMissingWarning + InsecurePlatformWarning
用pip安装一些包时遇到 SNIMissingWarning + InsecurePlatformWarning (unbuntu 12.04.5/python 2.7.3/pip 9.0.1) 具体细节如下,请高手指点,多谢! aiboat@ubuntu:/usr/local/bin$ sudo -H pip install pyopenssl ndg-httpsclient pyasn1 --upgrade /usr/local/lib/python2.7/dist-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Requirement already up-to-date: pyopenssl in /usr/local/lib/python2.7/dist-packages Requirement already up-to-date: ndg-httpsclient in /usr/local/lib/python2.7/dist-packages Requirement already up-to-date: pyasn1 in /usr/local/lib/python2.7/dist-packages Requirement already up-to-date: cryptography>=1.9 in /usr/local/lib/python2.7/dist-packages (from pyopenssl) Requirement already up-to-date: six>=1.5.2 in /usr/local/lib/python2.7/dist-packages (from pyopenssl) Requirement already up-to-date: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/dist-packages (from cryptography>=1.9->pyopenssl) Requirement already up-to-date: cffi>=1.7 in /usr/local/lib/python2.7/dist-packages (from cryptography>=1.9->pyopenssl) Requirement already up-to-date: ipaddress in /usr/local/lib/python2.7/dist-packages (from cryptography>=1.9->pyopenssl) Requirement already up-to-date: enum34 in /usr/local/lib/python2.7/dist-packages (from cryptography>=1.9->pyopenssl) Requirement already up-to-date: idna>=2.1 in /usr/local/lib/python2.7/dist-packages (from cryptography>=1.9->pyopenssl) Requirement already up-to-date: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.7->cryptography>=1.9->pyopenssl)
PHP 3DES 如何兼容 JAVA?
``` package com.test.utils; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import java.security.SecureRandom; import java.security.spec.KeySpec; /** * Des3工具类 */ public class Des3Utils { /** * @Description: DES3 解密 * @param key * @param src * @return String */ public static String decryptEde(String key, String src) { String plainText = null; try { byte[] keyBytes = new byte[24]; asciiToBcdBytes(key, keyBytes, Math.min(32, key.length()) / 2); for (int i = 0; i < 8; ++i) keyBytes[16 + i] = keyBytes[i]; // 从原始密匙数据创建一个DESKeySpec对象 KeySpec dks = new DESedeKeySpec(keyBytes); // 创建一个密匙工厂,然后用它把DESKeySpec对象转换成 // 一个SecretKey对象 SecretKey secKey = SecretKeyFactory.getInstance("DESede").generateSecret(dks); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding"); // DES算法要求有一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 用密匙初始化Cipher对象 cipher.init(Cipher.DECRYPT_MODE, secKey, sr); int count = (src.length() + 1) / 2; byte[] inputBytes = new byte[count]; asciiToBcdBytes(src, inputBytes, count); // 正式执行解密操作 byte[] decryptBytes = cipher.doFinal(inputBytes); int olen = decryptBytes.length - 1; for (; decryptBytes[olen] == 0 && olen >= 0; --olen) { } plainText = new String(decryptBytes, 0, olen + 1); } catch (Exception e) { e.printStackTrace(); } return plainText; } private static void asciiToBcdBytes(String str, byte[] hex, int count) { byte[] inputBytes = str.getBytes(); for (int i = 0, j = 0; j < inputBytes.length && i < count; ++i) { byte v = inputBytes[j]; ++j; if (v <= 0x39){ hex[i] = (byte) (v - 0x30); } else { hex[i] = (byte) (v - 0x41 + 10); } hex[i] <<= 4; if (j >= inputBytes.length) { break; } v = inputBytes[j]; ++j; if (v <= 0x39) { hex[i] += (byte) (v - 0x30); } else { hex[i] += (byte) (v - 0x41 + 10); } } } /** * @Description: DES3 加密 * @param key * @param src * @return String */ public static String encryptEde(String key, String src) { String plainText = null; try { byte[] keyBytes = new byte[24]; asciiToBcdBytes(key, keyBytes, Math.min(32, key.length()) / 2); for (int i = 0; i < 8; ++i) keyBytes[16 + i] = keyBytes[i]; // 从原始密匙数据创建一个DESKeySpec对象 KeySpec dks = new DESedeKeySpec(keyBytes); // 创建一个密匙工厂,然后用它把DESKeySpec对象转换成 // 一个SecretKey对象 SecretKey secKey = SecretKeyFactory.getInstance("DESede").generateSecret(dks); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding"); // DES算法要求有一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 用密匙初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, secKey, sr); byte[] srcBytes = src.getBytes("UTF-8"); int srcLen = srcBytes.length; int encLen = ((srcLen % 8) == 0) ? srcLen : ((srcLen / 8 + 1) * 8); byte[] encBytes = new byte[encLen]; System.arraycopy(srcBytes, 0, encBytes, 0, srcLen); // 正式执行解密操作 byte[] encryptBytes = cipher.doFinal(encBytes); plainText = bcdBytesToAscii(encryptBytes, encLen); } catch (Exception e) { e.printStackTrace(); } return plainText; } private static String bcdBytesToAscii(byte[] hex, int count) { byte[] ascii = new byte[2 * count]; int t; for (int i = 0; i < count; i++) { t = hex[i] & 0xf0; t = t >> 4; if (t <= 9) t += '0'; else if (t >= 10 && t <= 15) t += 'A' - 10; else t = '0'; ascii[2 * i] = (byte) t; t = hex[i] & 0x0f; if (t <= 9) t += '0'; else if (t >= 10 && t <= 15) t += 'A' - 10; else t = '0'; ascii[2 * i + 1] = (byte) t; } return (new String(ascii)); } } ``` 本人目前 php 使用的是 [3DES加密如何兼容Java](https://segmentfault.com/q/1010000007199868 "") 中的代码。
spring整合shiro时报错
项目是我从我同事那里拷贝过来的,在我同事电脑上运行没有问题,在我的电脑上运行就报这个错误,网上能搜到的方法全部都试过了,不能解决问题,求大神指点 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [config/shiro.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [config/shiro.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:235) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:702) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4792) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [config/shiro.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 24 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ... 32 more Caused by: java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:59) at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:43) at org.apache.shiro.mgt.AbstractRememberMeManager.<init>(AbstractRememberMeManager.java:99) at org.apache.shiro.web.mgt.CookieRememberMeManager.<init>(CookieRememberMeManager.java:87) at org.apache.shiro.web.mgt.DefaultWebSecurityManager.<init>(DefaultWebSecurityManager.java:75) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ... 34 more Caused by: java.security.NoSuchAlgorithmException: AES KeyGenerator not available at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169) at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223) at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:56) ... 43 more
RSA加密报错,哪位遇到过类似问题~跪求指点
import java.security.Key; import java.util.HashMap; import java.util.Map; import javax.crypto.Cipher; import sun.misc.BASE64Decoder; public String decrypt(){ Map<String, Object> keyMap= new HashMap<String, Object>(4); String decryptModeCode = null; Cipher cipher = null; BASE64Decoder decoder = new BASE64Decoder(); try { cipher = javax.crypto.Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(javax.crypto.Cipher.DECRYPT_MODE, (Key) keyMap.get("RSAPrivateKey")); decryptModeCode = new String(cipher.doFinal(decoder.decodeBuffer("中文")),"gb2312"); System.out.println("decryptModeCode is : " + decryptModeCode ); } catch (Exception e) { e.printStackTrace(); } return decryptModeCode; }
Python缺失module(ImportError: No module named Crypto.Util.py3compat)
我之前装过3.6和2.7,用3.6能检测到这个模块,但是用2.7不能。于是我卸载了3.6,还是无法解决。 ![图片说明](https://img-ask.csdn.net/upload/201810/01/1538381476_296832.png) ![图片说明](https://img-ask.csdn.net/upload/201810/01/1538381486_790525.png)
关于ApplicationStartingEvent的问题
``` "C:\Program Files\Java\jdk1.8.0_66\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\IDEA\IntelliJ IDEA 2019.1.1\lib\idea_rt.jar=49516:D:\IDEA\IntelliJ IDEA 2019.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_66\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\rt.jar;D:\Test\mcrm-seven\target\classes;D:\apache-tomcat-7.0.10\apache-tomcat-7.0.10\lib\jsp-api.jar;D:\apache-tomcat-7.0.10\apache-tomcat-7.0.10\lib\servlet-api.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\ojdbc14-10.2.0.4.0.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\pinyin4j-2.5.0.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\UserAgentUtils-1.13.jar;D:\Test\mcrm-seven\lib\javax.persistence.jar;D:\Test\mcrm-seven\lib\javax.transaction.jar;D:\Test\mcrm-seven\lib\javax.jms.jar;D:\Test\mcrm-seven\lib\javax.ejb.jar;D:\Test\mcrm-seven\lib\javax.servlet.jsp.jstl.jar;D:\Test\mcrm-seven\lib\javax.resource.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-log4j\1.3.8.RELEASE\spring-boot-starter-log4j-1.3.8.RELEASE.jar;C:\Users\17268\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.7\jcl-over-slf4j-1.7.7.jar;C:\Users\17268\.m2\repository\org\slf4j\jul-to-slf4j\1.7.7\jul-to-slf4j-1.7.7.jar;C:\Users\17268\.m2\repository\org\slf4j\slf4j-log4j12\1.7.7\slf4j-log4j12-1.7.7.jar;C:\Users\17268\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.2.2.RELEASE\spring-boot-starter-logging-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\com\alibaba\druid-spring-boot-starter\1.1.9\druid-spring-boot-starter-1.1.9.jar;C:\Users\17268\.m2\repository\com\alibaba\druid\1.1.9\druid-1.1.9.jar;C:\Users\17268\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.2.RELEASE\spring-boot-autoconfigure-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\net\sf\dozer\dozer\5.5.1\dozer-5.5.1.jar;C:\Users\17268\.m2\repository\org\freemarker\freemarker\2.3.20\freemarker-2.3.20.jar;C:\Users\17268\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\17268\.m2\repository\org\hamcrest\hamcrest-core\2.1\hamcrest-core-2.1.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.2.3\jackson-core-2.2.3.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.2.3\jackson-databind-2.2.3.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.2.3\jackson-annotations-2.2.3.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.2.3\jackson-module-jaxb-annotations-2.2.3.jar;C:\Users\17268\.m2\repository\net\sf\ehcache\ehcache-core\2.6.11\ehcache-core-2.6.11.jar;C:\Users\17268\.m2\repository\net\sf\ehcache\ehcache-web\2.0.4\ehcache-web-2.0.4.jar;C:\Users\17268\.m2\repository\redis\clients\jedis\3.1.0\jedis-3.1.0.jar;C:\Users\17268\.m2\repository\org\apache\commons\commons-pool2\2.7.0\commons-pool2-2.7.0.jar;C:\Users\17268\.m2\repository\com\thoughtworks\xstream\xstream\1.4.7\xstream-1.4.7.jar;C:\Users\17268\.m2\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;C:\Users\17268\.m2\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;C:\Users\17268\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\17268\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\17268\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\17268\.m2\repository\commons-fileupload\commons-fileupload\1.3.1\commons-fileupload-1.3.1.jar;C:\Users\17268\.m2\repository\commons-beanutils\commons-beanutils\1.9.1\commons-beanutils-1.9.1.jar;C:\Users\17268\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\analyzer-2012_u6.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\thumbnailator-0.4.2.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\apache-ant-zip-2.3.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\ckfinder-2.3.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\ckfinderplugin-fileeditor-2.3.jar;D:\Test\mcrm-seven\src\main\webapp\WEB-INF\lib\ckfinderplugin-imageresize-2.3.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.2.2.RELEASE\spring-boot-starter-data-redis-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter\2.2.2.RELEASE\spring-boot-starter-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;C:\Users\17268\.m2\repository\org\springframework\data\spring-data-redis\2.2.3.RELEASE\spring-data-redis-2.2.3.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\data\spring-data-keyvalue\2.2.3.RELEASE\spring-data-keyvalue-2.2.3.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\data\spring-data-commons\2.2.3.RELEASE\spring-data-commons-2.2.3.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-oxm\5.2.2.RELEASE\spring-oxm-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-aop\5.2.2.RELEASE\spring-aop-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-context-support\5.2.2.RELEASE\spring-context-support-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\io\lettuce\lettuce-core\5.2.1.RELEASE\lettuce-core-5.2.1.RELEASE.jar;C:\Users\17268\.m2\repository\io\netty\netty-common\4.1.43.Final\netty-common-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\netty\netty-handler\4.1.43.Final\netty-handler-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\netty\netty-buffer\4.1.43.Final\netty-buffer-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\netty\netty-codec\4.1.43.Final\netty-codec-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\netty\netty-transport\4.1.43.Final\netty-transport-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\netty\netty-resolver\4.1.43.Final\netty-resolver-4.1.43.Final.jar;C:\Users\17268\.m2\repository\io\projectreactor\reactor-core\3.3.1.RELEASE\reactor-core-3.3.1.RELEASE.jar;C:\Users\17268\.m2\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;C:\Users\17268\.m2\repository\org\apache\poi\poi\3.9\poi-3.9.jar;C:\Users\17268\.m2\repository\org\apache\poi\poi-ooxml\3.9\poi-ooxml-3.9.jar;C:\Users\17268\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\17268\.m2\repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar;C:\Users\17268\.m2\repository\org\apache\poi\poi-ooxml-schemas\3.9\poi-ooxml-schemas-3.9.jar;C:\Users\17268\.m2\repository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar;C:\Users\17268\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;C:\Users\17268\.m2\repository\com\drewnoakes\metadata-extractor\2.6.2\metadata-extractor-2.6.2.jar;C:\Users\17268\.m2\repository\com\adobe\xmp\xmpcore\5.1.2\xmpcore-5.1.2.jar;C:\Users\17268\.m2\repository\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar;C:\Users\17268\.m2\repository\com\google\zxing\core\2.2\core-2.2.jar;C:\Users\17268\.m2\repository\com\google\zxing\javase\2.2\javase-2.2.jar;C:\Users\17268\.m2\repository\com\google\guava\guava\17.0\guava-17.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-engine\5.21.0\activiti-engine-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-bpmn-converter\5.21.0\activiti-bpmn-converter-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-bpmn-model\5.21.0\activiti-bpmn-model-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-process-validation\5.21.0\activiti-process-validation-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-image-generator\5.21.0\activiti-image-generator-5.21.0.jar;C:\Users\17268\.m2\repository\org\apache\commons\commons-email\1.4\commons-email-1.4.jar;C:\Users\17268\.m2\repository\com\sun\mail\javax.mail\1.5.2\javax.mail-1.5.2.jar;C:\Users\17268\.m2\repository\javax\activation\activation\1.1.1\activation-1.1.1.jar;C:\Users\17268\.m2\repository\org\springframework\spring-beans\5.2.2.RELEASE\spring-beans-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\joda-time\joda-time\2.10.5\joda-time-2.10.5.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-spring\5.21.0\activiti-spring-5.21.0.jar;C:\Users\17268\.m2\repository\org\springframework\spring-context\5.2.2.RELEASE\spring-context-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-expression\5.2.2.RELEASE\spring-expression-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-jdbc\5.2.2.RELEASE\spring-jdbc-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-tx\5.2.2.RELEASE\spring-tx-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-orm\5.2.2.RELEASE\spring-orm-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\commons-dbcp\commons-dbcp\1.4\commons-dbcp-1.4.jar;C:\Users\17268\.m2\repository\commons-pool\commons-pool\1.6\commons-pool-1.6.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-explorer\5.21.0\activiti-explorer-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-json-converter\5.21.0\activiti-json-converter-5.21.0.jar;C:\Users\17268\.m2\repository\math\geom2d\javaGeom\0.11.1\javaGeom-0.11.1.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-crystalball\5.21.0\activiti-crystalball-5.21.0.jar;C:\Users\17268\.m2\repository\com\h2database\h2\1.4.200\h2-1.4.200.jar;C:\Users\17268\.m2\repository\org\springframework\spring-core\5.2.2.RELEASE\spring-core-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-jcl\5.2.2.RELEASE\spring-jcl-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\spring-web\5.2.2.RELEASE\spring-web-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\imgscalr\imgscalr-lib\4.2\imgscalr-lib-4.2.jar;C:\Users\17268\.m2\repository\org\codehaus\groovy\groovy-all\2.4.5\groovy-all-2.4.5.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-modeler\5.21.0\activiti-modeler-5.21.0.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-common-rest\5.21.0\activiti-common-rest-5.21.0.jar;C:\Users\17268\.m2\repository\org\springframework\spring-webmvc\5.2.2.RELEASE\spring-webmvc-5.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\security\spring-security-config\5.2.1.RELEASE\spring-security-config-5.2.1.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\security\spring-security-core\5.2.1.RELEASE\spring-security-core-5.2.1.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\security\spring-security-crypto\5.2.1.RELEASE\spring-security-crypto-5.2.1.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\security\spring-security-web\5.2.1.RELEASE\spring-security-web-5.2.1.RELEASE.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-parser\1.7\batik-parser-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-awt-util\1.7\batik-awt-util-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-util\1.7\batik-util-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-xml\1.7\batik-xml-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-transcoder\1.7\batik-transcoder-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\fop\0.94\fop-0.94.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\xmlgraphics-commons\1.2\xmlgraphics-commons-1.2.jar;C:\Users\17268\.m2\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar;C:\Users\17268\.m2\repository\org\apache\avalon\framework\avalon-framework-api\4.3.1\avalon-framework-api-4.3.1.jar;C:\Users\17268\.m2\repository\org\apache\avalon\framework\avalon-framework-impl\4.3.1\avalon-framework-impl-4.3.1.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-dom\1.7\batik-dom-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-gvt\1.7\batik-gvt-1.7.jar;C:\Users\17268\.m2\repository\xml-apis\xml-apis-ext\1.3.04\xml-apis-ext-1.3.04.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-bridge\1.7\batik-bridge-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-anim\1.7\batik-anim-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-ext\1.7\batik-ext-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-script\1.7\batik-script-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-js\1.7\batik-js-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-codec\1.7\batik-codec-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-css\1.7\batik-css-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-svg-dom\1.7\batik-svg-dom-1.7.jar;C:\Users\17268\.m2\repository\org\apache\xmlgraphics\batik-svggen\1.7\batik-svggen-1.7.jar;C:\Users\17268\.m2\repository\org\activiti\activiti-diagram-rest\5.21.0\activiti-diagram-rest-5.21.0.jar;C:\Users\17268\.m2\repository\org\apache\shiro\shiro-core\1.2.3\shiro-core-1.2.3.jar;C:\Users\17268\.m2\repository\org\apache\shiro\shiro-spring\1.2.3\shiro-spring-1.2.3.jar;C:\Users\17268\.m2\repository\org\apache\shiro\shiro-cas\1.2.3\shiro-cas-1.2.3.jar;C:\Users\17268\.m2\repository\org\jasig\cas\client\cas-client-core\3.2.1\cas-client-core-3.2.1.jar;C:\Users\17268\.m2\repository\org\apache\shiro\shiro-web\1.2.3\shiro-web-1.2.3.jar;C:\Users\17268\.m2\repository\org\apache\shiro\shiro-ehcache\1.2.3\shiro-ehcache-1.2.3.jar;C:\Users\17268\.m2\repository\mysql\mysql-connector-java\8.0.18\mysql-connector-java-8.0.18.jar;C:\Users\17268\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.2.2.RELEASE\spring-boot-starter-jdbc-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\com\zaxxer\HikariCP\3.4.1\HikariCP-3.4.1.jar;C:\Users\17268\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;C:\Users\17268\.m2\repository\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.2.2.RELEASE\spring-boot-starter-web-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.2.2.RELEASE\spring-boot-starter-json-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.1\jackson-datatype-jdk8-2.10.1.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.1\jackson-datatype-jsr310-2.10.1.jar;C:\Users\17268\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.1\jackson-module-parameter-names-2.10.1.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-validation\2.2.2.RELEASE\spring-boot-starter-validation-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.1\jakarta.validation-api-2.0.1.jar;C:\Users\17268\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.18.Final\hibernate-validator-6.0.18.Final.jar;C:\Users\17268\.m2\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;C:\Users\17268\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\17268\.m2\repository\org\projectlombok\lombok\1.18.10\lombok-1.18.10.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.2.2.RELEASE\spring-boot-starter-tomcat-2.2.2.RELEASE.jar;C:\Users\17268\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\17268\.m2\repository\org\hamcrest\hamcrest\2.1\hamcrest-2.1.jar;C:\Users\17268\.m2\repository\org\mybatis\mybatis\3.5.3\mybatis-3.5.3.jar;C:\Users\17268\.m2\repository\org\springframework\boot\spring-boot\1.4.3.RELEASE\spring-boot-1.4.3.RELEASE.jar;C:\Users\17268\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.29\tomcat-embed-core-9.0.29.jar" com.thinkgem.jeesite.McrmSevenApplication Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/context/event/ApplicationStartingEvent at org.springframework.boot.autoconfigure.BackgroundPreinitializer.onApplicationEvent(BackgroundPreinitializer.java:68) at org.springframework.boot.autoconfigure.BackgroundPreinitializer.onApplicationEvent(BackgroundPreinitializer.java:50) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:63) at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run(SpringApplication.java:304) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) at com.thinkgem.jeesite.McrmSevenApplication.main(McrmSevenApplication.java:13) Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.event.ApplicationStartingEvent at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 12 more Process finished with exit code 1 ```
微信小程序解密encryptedData报错
报错如下:javax.crypto.IllegalBlockSizeException: last block incomplete in decryption at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source) at javax.crypto.Cipher.doFinal(Cipher.java:2165) at com.zhjd.app.API.AES.decrypt(AES.java:41) at com.zhjd.marked.controller.WxController.login(WxController.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 工具类AES: */ public static byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException { initialize(); try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); Key sKeySpec = new SecretKeySpec(keyByte, "AES"); cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化 byte[] result = cipher.doFinal(content);(此句为报错的语句AES.java:41) return result; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); ...... Controller: byte[] resultByte = AES.decrypt(Base64.decodeBase64(encryptedData), Base64.decodeBase64(session_key), Base64.decodeBase64(iv)); ..... (其中byte[] resultByte = AES.decrypt(Base64.decodeBase64(encryptedData),)这一行为报错句WxController.java:49
python 关于 OpenSSL.crypto 模块验签问题
对接一个接口,在数据发送与接收时需要rsa签名和验签。 采用 OpenSSL.crypto 模块进行签名 签名的主要部分是: ``` from OpenSSL.crypto import load_privatekey,FILETYPE_PEM,sign,verify def tosign(data,private_key): key = load_privatekey(FILETYPE_PEM, private_key) return base64.b64encode(sign(key,data,'sha1')) def verysign(data,getsign,public_key): sign = base64.b64decode(getsign) key = load_certificate(FILETYPE_PEM,public_key) ret = verify(key,sign,data,'sha1') return ret ``` 密钥是”BEGIN RSA PRIVATE KEY --- END RSA PRIVATE KEY” 公钥是 “ BEGIN PUBLIC KEY --- END PUBLIC KEY” 签名是没有问题的,但是验签会报错:[('PEM routines', 'PEM_read_bio', 'no start line')] 对一些加密解密加签的本来就不熟,在 google 后更加蒙蔽了,所以想请问各位大佬指出一下问题,给个解决方案或者一点建议
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
开源一个功能完整的SpringBoot项目框架
福利来了,给大家带来一个福利。 最近想了解一下有关Spring Boot的开源项目,看了很多开源的框架,大多是一些demo或者是一个未成形的项目,基本功能都不完整,尤其是用户权限和菜单方面几乎没有完整的。 想到我之前做的框架,里面通用模块有:用户模块,权限模块,菜单模块,功能模块也齐全了,每一个功能都是完整的。 打算把这个框架分享出来,供大家使用和学习。 为什么用框架? 框架可以学习整体
源码阅读(19):Java中主要的Map结构——HashMap容器(下1)
(接上文《源码阅读(18):Java中主要的Map结构——HashMap容器(中)》) 3.4.4、HashMap添加K-V键值对(红黑树方式) 上文我们介绍了在HashMap中table数组的某个索引位上,基于单向链表添加新的K-V键值对对象(HashMap.Node&lt;K, V&gt;类的实例),但是我们同时知道在某些的场景下,HashMap中table数据的某个索引位上,数据是按照红黑树
c++制作的植物大战僵尸,开源,一代二代结合游戏
    此游戏全部由本人自己制作完成。游戏大部分的素材来源于原版游戏素材,少部分搜集于网络,以及自己制作。 此游戏为同人游戏而且仅供学习交流使用,任何人未经授权,不得对本游戏进行更改、盗用等,否则后果自负。 目前有六种僵尸和六种植物,植物和僵尸的动画都是本人做的。qq:2117610943 开源代码下载 提取码:3vzm 点击下载--&gt; 11月28日 新增四种植物 统一植物画风,全部修
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
深度学习图像算法在内容安全领域的应用
互联网给人们生活带来便利的同时也隐含了大量不良信息,防范互联网平台有害内容传播引起了多方面的高度关注。本次演讲从技术层面分享网易易盾在内容安全领域的算法实践经验,包括深度学习图
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程实用技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法,并会持续更新。
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
"狗屁不通文章生成器"登顶GitHub热榜,分分钟写出万字形式主义大作
GitHub 被誉为全球最大的同性交友网站,……,陪伴我们已经走过 10+ 年时间,它托管了大量的软件代码,同时也承载了程序员无尽的欢乐。 万字申请,废话报告,魔幻形式主义大作怎么写?兄dei,狗屁不通文章生成器了解一下。这个富有灵魂的项目名吸引了众人的目光。项目仅仅诞生一周,便冲上了GitHub趋势榜榜首(Js中文网 -前端进阶资源教程)、是榜首哦
推荐几款比较实用的工具,网站
1.盘百度PanDownload 这个云盘工具是免费的,可以进行资源搜索,提速(偶尔会抽风????) 不要去某站买付费的???? PanDownload下载地址 2.BeJSON 这是一款拥有各种在线工具的网站,推荐它的主要原因是网站简洁,功能齐全,广告相比其他广告好太多了 bejson网站 3.二维码美化 这个网站的二维码美化很好看,网站界面也很...
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
相关热词 c#处理浮点数 c# 生成字母数字随机数 c# 动态曲线 控件 c# oracle 开发 c#选择字体大小的控件 c# usb 批量传输 c#10进制转8进制 c#转base64 c# 科学计算 c#下拉列表获取串口
立即提问