微信小程序解密encryptedData报错 20C

报错如下: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

2个回答

这个应该是没有解密出来正确的数据 原因是你获取的session_key ,不是加密时候用的那个session_key 我也遇到过这个情况 我的情况是前端获取的code
和得到的加密数据 两个请求顺序有问题 应该先拿到code 在获取加密的数据 这样你可以根据code获取最新的session_key 加密的数据也是经过刚获取的session_key 加密的

weixin_41302685
weixin_41302685 回复lsw789: 你解决了吗
大约一年之前 回复
lsw789
lsw789 哈哈,确实是良心回答,好多人都掉进了这个坑。
一年多之前 回复
biu_biu_duda
biu_biu_duda 良心回答,赞赞赞
接近 2 年之前 回复

public static byte[] decrypt(String encryptedDataStr, String keyBytesStr, String ivStr) {
byte[] encryptedText = null;
byte[] encryptedData = null;
byte[] sessionkey = null;
byte[] iv = null;

    try {
        sessionkey = Base64.decodeBase64(keyBytesStr);
        encryptedData = Base64.decodeBase64(encryptedDataStr);
        iv = Base64.decodeBase64(ivStr);

        init(sessionkey);

        cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
        encryptedText = cipher.doFinal(encryptedData);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return encryptedText;
}
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
微信小程序util.js里写登录的方法返回的结果怎么是undefined?

我把这个登录方法现在util.js里,调用后出来的结果是undefined,我能这么写吗? ``` function wxlogin () { wx.login ({ success: function (res) { let code = res.code; if (code) { wx.getUserInfo({ success: function (res) { wx.request ({ url: run_url + "weixin/getUserInfo", header: { 'content-type': 'application/json' }, data: { encryptedData: res.encryptedData, iv: res.iv, code: code }, success: function (res) { let userContent = res.data.userContent; if (userContent == '' || userContent == undefined) { console.log("login error!"); } else { var openId = userContent.openId; var sessionKey = userContent.sessionKey; var userId; if (res.data.status) { userId = userContent.userId; } else { userId = '' } return { openId: openId, sessionKey: sessionKey, userId: userId } } }, fail: function (err) { console.log("login error!"); return false; } }) }, fail: function (err) { console.log("user has not authorized to USERINFO yet!"); return false; } }) } else { console.log("err"); return false; } }, fail: function (err) { console.log("err"); return false; } }) } ```

php后台 base64_decode 解码sessionKey,encryptedData,iv全部乱码,其他的字符串能正常解码

![图片说明](https://img-ask.csdn.net/upload/202006/19/1592556832_844959.png) 微信小程序 登录授权 后台解码获取个人信息的时候,发现base64解码这三个参数,全部都是乱码,导致个人信息获取不到,授权失败

用AES解密中用到问题,线下本地可以,线上就出现了问题,怎么解决

本人开发小程序对encryptedData解密出现的问题 线下本地可以没有报错,线上就出现了问题! ![图片说明](https://img-ask.csdn.net/upload/201909/13/1568352145_29303.png) 我jar包是有这个JCEPERKey类的,就是运行时JVM找不到,线下本地运行环境是window,线上服务器运行环境是linux,是运行环境的问题吗,很是挠头!

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; }

微信进行网页授权时,拿到了code,怎么获取不到openid?(如图)

![![![![图片说明](https://img-ask.csdn.net/upload/201510/24/1445661934_667923.png)图片说明](https://img-ask.csdn.net/upload/201510/24/1445661926_318804.png)图片说明](https://img-ask.csdn.net/upload/201510/24/1445661917_190682.png)图片说明](https://img-ask.csdn.net/upload/201510/24/1445661900_145746.png) 求大神指教,看看问题出现在什么地方,找了好久不知道原因所在

前端jsencrypt加密,后端无法解密

## 前后端RSA加密 > 在做一个web安全登录的作业时,遇到前后端RSA加密问题。。 1. 后端 java 生成RSA密钥对,privateKey,publicKey 后端RSA是从帖子上抄的: (学习加密四spring boot 使用RSA+AES混合加密,前后端传递参数加解密)[https://blog.csdn.net/baidu_38990811/article/details/83540404] **使用PKCS8规范** ``` // 后端部分代码 RSA /** * 生成密钥对(公钥和私钥) * @return * @throws Exception */ public static Map<String, Object> genKeyPair() throws Exception { KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); keyPairGen.initialize(INITIALIZE_LENGTH); KeyPair keyPair = keyPairGen.generateKeyPair(); RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); Map<String, Object> keyMap = new HashMap<String, Object>(2); keyMap.put(PUBLIC_KEY, publicKey); keyMap.put(PRIVATE_KEY, privateKey); return keyMap; } /** * 私钥解密 * @param encryptedData 已加密数据 * @param privateKey 私钥(BASE64编码) * @return * @throws Exception */ public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) throws Exception { byte[] keyBytes = Base64.decodeBase64(privateKey); PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, privateK); int inputLen = encryptedData.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; // 对数据分段解密 while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_DECRYPT_BLOCK) { cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); } else { cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_DECRYPT_BLOCK; } byte[] decryptedData = out.toByteArray(); out.close(); return decryptedData; } ``` 2. 前端:vue+webpack - 从后端获取一个公钥**publicKey** - 使用jsencrypt 和 **publicKey**加密内容,得到String encrypted 3. 后端拿到传回的encrypted, 再解密时报错 ``` javax.crypto.BadPaddingException: Decryption error at sun.security.rsa.RSAPadding.unpadV15(RSAPadding.java:383) at sun.security.rsa.RSAPadding.unpad(RSAPadding.java:294) at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363) at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:389) at javax.crypto.Cipher.doFinal(Cipher.java:2222) at com.security.loginserver.Util.RSAUtils.decryptByPrivateKey(RSAUtils.java:126) at com.security.loginserver.Util.RSAUtils.decryptDataOnJava(RSAUtils.java:285) ``` ## 测试情况 1. 后端单独测试RSA加密解密,正常 2. 前端单独测试RSA加密解密,使用后端的publicKey和privatekey正常 3. 搜到的贴子说,原因是JSEncrypt使用pkcs1规范,后端java用了**PKCS8规范**,,,然后就无从下手了 4. 求助大佬

在用GO语言加密的同时,如何在c#中解密RSA加密的字符串。 解码OAEP填充时发生错误

<div class="post-text" itemprop="text"> <p>I have an application running on c# and another server application in go. I need to implement secure communication using rsa. <br>What i'am doing is I've initialized the RSA provider in my C# application and generated public key to extract Modulus and Exponent. Then concatenated the modulus (Hexadecimal) and exponent (int) and converted this string to Base64 string, send it to a GO endpoint. </p> <p>Here is C# code snippet</p> <pre><code>public string ConvertToPublicKey() { CspParameters rsaParameters = GetCspParameters(); RSACryptoServiceProvider provider = newRSACryptoServiceProvider(rsaParameters); string paramsXml = RsaProvider.ToXmlString(false); XDocument xDocument = XDocument.Parse(paramsXml); string modulus = xDocument.Descendants().FirstOrDefault(x =&gt; x.Name == "Modulus")?.Value ?? string.Empty; string exponent = xDocument.Descendants().FirstOrDefault(x =&gt; x.Name == "Exponent")?.Value ?? string.Empty; byte[] base64BytesOfModulus = Convert.FromBase64String(modulus); string hexaDecimalofModulus = BitConverter.ToString(base64BytesOfModulus).Replace("-", string.Empty); byte[] base64BytesOfExponent = Convert.FromBase64String(exponent); string hexadecimalOfExponent = BitConverter.ToString(base64BytesOfExponent).Replace("-", string.Empty); int intOfExponent = Convert.ToInt32(hexadecimalOfExponent, 16); byte[] publicKey = Encoding.UTF8.GetBytes($"{hexaDecimalofModulus};{intOfExponent}"); return Convert.ToBase64String(publicKey); } private static CspParameters GetCspParameters() { const string containerName = "KeyContainer"; return new CspParameters { KeyContainerName = containerName, Flags = CspProviderFlags.UseMachineKeyStore }; } </code></pre> <p>At Go endpoint I received public key and modulus correctly. Then I encrypted the message using public key and sent it back to c# application in response after converting encrypted message byte[] to base64.</p> <p>Here is GO code snippet</p> <pre><code>func GetLicenseInfo(responseWriter http.ResponseWriter,request*http.Request) { encryptionKey := request.Header.Get("Authorization") var decodedStringBytes, errors = b64.StdEncoding.DecodeString(encryptionKey) if errors == nil { var decodedString = string(decodedStringBytes) result := strings.Split(decodedString, ";") modulus := new(big.Int) modulus.SetString(result[0], 16) exponent, exponentErrors := strconv.Atoi(result[1]) if exponentErrors == nil { var someInfo = utils.GetInfo() var InfoInJson = ToJson(someInfo) publicKey := &amp;rsa.PublicKey{N: modulus, E: exponent} var encryptedMessage, err = rsa.EncryptOAEP(sha256.New(),rand.Reader, publicKey,[]byte(InfoInJson), []byte("")) var response = b64.StdEncoding.EncodeToString(encryptedMessage) if err == nil { json.NewEncoder(responseWriter).Encode(response) } } } } func ToJson(model InfoModel) string { InfoInJson, errors := json.Marshal(model) if errors != nil { panic("An error occurred while serializing the response") } return string(InfoInJson) } </code></pre> <p>When i received the response back in Base64 string i converted it to <code>Byte[]</code> and tried decrypting that with same instance of <code>RSACryptoServiceProvider</code> then it throws the following exception</p> <blockquote> <p>Error occurred while decoding OAEP padding.</p> </blockquote> <p>any help?</p> <p><strong>UPDATE</strong> for example here is the base64 string that i received in GO </p> <blockquote> <p>QUQ2NDlFRTlCQTA3Q0IxNEI1MTNDMzczQzBBMjNBOEQyMDI5MkVGQTBFMjgyNUIyMEEyMzM1MEE3OTUyNjgyQ0Y3MEFBQjJBMTZGMzQyNTM4MkU2RDZBRjU5M0IxRTI2MTE0OEIyQkFFRTY3MUVDMTQ1NDk1NjBDRkNEQUNCQzI3RUUxNDRFODZDQUI4RDBDOUY2OENBNTUwNUMxQjZGQkVBQjQ0MTlBMjg3RDhBRjgxRDUyREY3MEM0RDZDQTA5MkREMzk5Q0NEODU5Q0FGQzAzQ0JEQ0JBQzgwOTg3NDY0NThBMkY4NEREOTc1QjU5QTJBMUNBNzQxQTBDNkQ2RDs2NTUzNw==</p> </blockquote> <p>and here is what my GO app sent back</p> <blockquote> <p>QuWpWdEPSJR+l9UJTkh+heJJ/NpPwhz/hVVu1VdKYdz37YGWWdKTj7Fc5lZ3A8p1WjtC4F+yieZCz0tEatCqTpRmm9g6Oioyjbtr9qGTxO/PE+GA33YyBe6nmMRe674SPePx/fg6l3nnfSZ4/+iLCV4bNgyNqFHCaXc7H4Snms8=</p> </blockquote> <p><strong>UPDATE 2</strong> I've updated the code snippet and included the data types and here is the part that dscrypts the content received from GO end point</p> <pre><code>public byte[] Decrypt(byte[] encryptedData, RSAParameters rsaParameters) { RsaProvider.ImportParameters(rsaParameters); return RsaProvider.Decrypt(encryptedData, true); } </code></pre> <p>i receive a base64 string then i convert to byte[] using this </p> <pre><code>byte[] b = Convert.FromBase64String(responseString); byte[] decryptedBytes=crypto.Decrypt(b, crypto.RsaProvider.ExportParameters(false)); </code></pre> <p>crypto is the instance of the class that contains decryption logic,instacne of <code>RSACryptoServiceProvider</code> and that method(ConvertToPublicKey) given above returning the public key</p> </div>

小程序 會員登錄php後台問題

我用的後台是cms 這個...目前還沒到 我想問的是 我現在可以拿到sessionkey 可是我編譯到$errCode = $userInfo->decryptData($encryptedData, $iv, $data); 我不知道data是啥 但是一直報int-41001 我上網說是token有問題 請問各位大大 這個$data到底哪裡來的...是上面的嗎 另外 我該怎麼解決這個問題啊?這裡過去 我應該可以拿到openId希望大大幫忙解答 已解決

RSA Javascript加密和Golang解密

<div class="post-text" itemprop="text"> <p>I have a scenario where I need to use <strong>RSA public key encryption standard</strong> with <strong>JavaScript</strong> and <strong>Golang</strong>. I need to encrypt data in JavaScript using public key and decrypt the same in Golang using the private key. I tried using <strong>PKCS#1(travst library for JavaScript and crypto/rsa for Golang)</strong>, but failed in decryption. Can anyone suggest solutions for this?</p> <p><strong>I tried all possible solutions and researched many documents, but still I couldn't find a proper method. If I do encrypt and decrypt within golang, its working fine. But there is some integration problem between javascript and golang. I am not sure about the padding methodology used in javasript.</strong></p> <p>This is my golang code to decrypt: </p> <pre><code>func Decrypt(encryptedData, label []byte) (decryptedData []byte) { var err error var block *pem.Block var private_key *rsa.PrivateKey if block, _ = pem.Decode([]byte(privatKeyData)); block == nil || block.Type != "RSA PRIVATE KEY" { //privatKeyData is in string format log.Fatal("No valid PEM data found") } //Read Private Key if private_key, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { log.Fatalf("Private key can't be decoded: %s", err) } //Decrypt if decrypted, err = rsa.DecryptPKCS1v15(rand.Reader, private_key, encryptedData); err != nil { log.Println(err) } return } </code></pre> </div>

缺少前16个字符:Java AES CBC加密和golang解密

<div class="post-text" itemprop="text"> <p>我使用以下代码对Java中的数据进行加密和解密。加密和解密工作正常:</p> <pre><code>import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; import java.security.SecureRandom; public class MainNew { public static void main(String[] args) throws Exception{ String iv = getEncryptionIV(); System.out.println(" iv = "+iv); String encryptedData= encryptWithIVandKey(iv,encryptionKey,"hello world! golang is awesome!"); System.out.println(encryptedData); String decryptedData = decrypt (iv,encryptionKey,encryptedData); System.out.println(decryptedData); } static final String encryptionKey = "rakesh1@n1111112"; static byte[] doFinal(int encryptMode, SecretKey key, String iv, byte[] bytes) { try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(encryptMode, key, new IvParameterSpec(DatatypeConverter.parseBase64Binary(iv))); byte[] data = cipher.doFinal(bytes); return data; } catch (Exception e) { e.printStackTrace(); System.out.println(e); } return null; } static SecretKey generateKey(String passphrase) { SecretKey key = null; try { key = new SecretKeySpec(passphrase.getBytes("UTF-8"), "AES"); } catch (Exception e) { e.printStackTrace(); System.out.println(e); } return key; } static String getEncryptionIV() { SecureRandom random = new SecureRandom(); byte[] ivBytes = new byte[16]; random.nextBytes(ivBytes); return DatatypeConverter.printBase64Binary(ivBytes); } static String encryptWithIVandKey( String iv, String passphrase, final String strToEncrypt) { String encryptedStr = ""; try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKey key = generateKey(passphrase); cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(DatatypeConverter.parseBase64Binary(iv))); encryptedStr = DatatypeConverter.printBase64Binary(cipher.doFinal(strToEncrypt.getBytes("UTF-8"))); } catch (Exception e) { e.printStackTrace(); System.out.println(e); } return encryptedStr; } static String decrypt(String iv, String passphrase, String ciphertext) { try { SecretKey key = generateKey(passphrase); byte[] decrypted = doFinal(Cipher.DECRYPT_MODE, key, iv, DatatypeConverter.parseBase64Binary(ciphertext)); return new String(decrypted, "UTF-8"); } catch (Exception e) { e.printStackTrace(); System.out.println(e); } return ""; } } </code></pre> <p>但如果我使用<a href="https://play.golang.org/p/u4fip_ZW6a" rel="nofollow noreferrer">https://play.golang.org/p/u4fip_ZW6a</a> 来解密 golang,前16个字符在解密值中丢失。</p> </div>

如何用PHP解密SAML?

<div class="post-text" itemprop="text"> <p>I have an application that I'm trying to integrate with Federated Security -- specifically, Siteminder. I'm using the PHP-SAML toolkit found here: <a href="https://github.com/onelogin/php-saml" rel="nofollow">https://github.com/onelogin/php-saml</a></p> <p>I have the x509 cert included in the application, and all works well, until encryption is turned on in the Siteminder environment. Once that was turned on, I was no longer able to log in -- I received this message: <strong>Invalid SAML response: Cannot locate Signature Node</strong></p> <p>I've been able to determine that the SAML assertion being sent to the application, from Siteminder, is encrypted. I'm able to see the assertion (sample included below). Unfortunately, I can't figure out how to decrypt that message, so that I can then parse and use in my application.</p> <pre><code>&lt;Response xmlns="urn:oasis:names:tc:SAML:2.0:protocol" Destination="{VALUE HERE}" ID="_076e8f69ec4adb3b72f0cc76570527222e37" IssueInstant="2013-01-15T18:18:48Z" Version="2.0" &gt; &lt;ns1:Issuer xmlns:ns1="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" &gt;{VALUE HERE}&lt;/ns1:Issuer&gt; &lt;Status&gt; &lt;StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /&gt; &lt;/Status&gt; &lt;ns2:EncryptedAssertion xmlns:ns2="urn:oasis:names:tc:SAML:2.0:assertion"&gt; &lt;xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Element" &gt; &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" /&gt; &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt; &lt;xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt; &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /&gt; &lt;xenc:CipherData&gt; &lt;xenc:CipherValue&gt;{VALUE HERE}&lt;/xenc:CipherValue&gt; &lt;/xenc:CipherData&gt; &lt;/xenc:EncryptedKey&gt; &lt;ds:X509Data&gt; &lt;ds:X509Certificate&gt; {CERTIFICATE HERE} &lt;/ds:X509Certificate&gt; &lt;/ds:X509Data&gt; &lt;/ds:KeyInfo&gt; &lt;xenc:CipherData&gt; &lt;xenc:CipherValue&gt;{VALUE HERE}&lt;/xenc:CipherValue&gt; &lt;/xenc:CipherData&gt; &lt;/xenc:EncryptedData&gt; &lt;/ns2:EncryptedAssertion&gt; &lt;/Response&gt; </code></pre> <p>If anyone can help, that would be amazing.</p> </div>

用base64解码以后得到的是乱码怎么办

是这样的 我发送了一个个体请求 服务器给我的响应是一个json 其中有一个明显是用base64加密后的结果 于是我就用base64解密 本来结果应该是中文字符串的 但是我这边显示的却是乱码 请问是为什么 是还作了什么处理吗?我得到的base64加密后的结果如下 44PN44PN6YJx57dv6Vzl55+g5L+E55Jy5cv+6Mh25Yzk77lZ5nnP5MPZ5cdK5nFp5Yvg6Yrm6YrQ55dR54Te57X+54T177lZ57dv6Vzl57Fa6Yde55dh6XTw5bdX6nhL5blE6Yde5c2D77lZ5Lh+5LhF5Lr65clN5n6Z576B55dR5d+H5Y6Y44PPCTWlYm7wtVQwtVQyaXwbi5abe7UxheexhLibu7CazbGbhdizaMQxh6KycWoiiVmycoabi5wzv6KzaVazy6Qyw6/zwWUyvMGazbGyeeacbcmwtVV8LaViChBNtBBNtBzgyBzfiBv6d+nqxBBNtwkvpv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wtVQwtVQycoCbenoaaVibgoszanKxhbmywLUyu7eycYGiiVmywMKbeeeaz7wbfbmaecsxhV3xhVeytY7yz73ytY7ya47iiVmxiLoxhM/ah53ye7ayfM7xhb7aib7ycoCxhLiyvWswtVYzaVQyiWKxheezf6wzuV/azbGzzX/ctdCyw4maaYmaaMiiiVmaebQaz7GyfYUzzX/xh47xhbmzeXUyuLCyu7ezanKazbGiiVmavoayvXiycXsiiVmavoayvXizhVKzibwwtVUzzV7xhd7wtVUzaVaacM7iiVmyub3cuL3xhVeciMQyvWwzgosazbGydVCydVCycYGctXQyabiiiVmah5axheeyibwafe7atoKzgYizf7mazbGzuW/bc4awtVV8LaViChBNtBBNtBXNaBrydBF7gmR45M2K44PP4bPq6VXy56TI55dR5nJm5YzL5Ldu5MTL6M2v5crt6XTb5bBS44PPCTWlYm7wtVQwtVQvtWmah5awtVYvtW08LaViChBNtBBNtBJ5gBv9h+F6hhnHghJoahnpvrnjyBnKbBJXz+rnuBroehJSvr+8wBF7whJCb+vvv+zUwBnBw+JUhhF4tBJ8bBzFahrydBzNxhv/u+JBh+BNtwkvpv8+44PN44PN5nJm5YzL5Ldu5MTL5bFw5YdT5bFw77lZ6LXw5olt5clf5oPk6VXy56TI55dR6VF477lZ56hY6nzf5L+L5o6K5YvA5nJ955lY5YdT77ln4bPp5Y2t6Y+M5cvi5YhN5YzV6MXk77ls6LPK5bvE546c5MTv77ls77lO4bPqCTWlYm7wtVQwtVQvtWmbi5acxeUvtXovtXoxhV3bt73ayXwiiW/vtW3yhoGbioixheeazeUaaVawtVV8LaViChBNtBBNtBXNaBF4wrvQir+8trXNarJyf+F5zBJXbrJEzBJ+vBF4wrJCv+JJuBBNtwkvpv8+44PN44PN4bPp55+y6LTG5YdT44PP4bPqCTWlYm7wtVQwtVQyhoGbioixheebtYwxhbobtYwbtdabubQiiVmye7abinoywdYcu4mazbGxhMwyedYcy67ctMCiiWevtWmbe7scy67iiVmzaVazfdUzaVaxheeyhX7zvWUzwnYxh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eeaain7aycUazbGyxo3xh6GwtVV8LaViChBNtBBNtBXNaBF9bBXNchXNchXNarz7uBniz+Jxc+nNxhBNtwkvpv8+44PN44PN4bPp562W5YvN5YvY77lO4bPqCTWlYm7wtVQwtVQycoCbenobuYwbvoYzzV7zzY7yw5wxhboiiVmycoaadbUauYoyiX/buoQzwnUbgosxhVQzfcCcxc7acnwiiVmyxLoyxLoazbGbe7GctMCiiWevtWmbi5axhcivtXovtXobi5axhcizeXsyuLCzzX/aaW/azbGvtXovtXovtW0wVlZwVj==

使用c#中的公钥加密数据,并使用php中的私钥解密数据

<div class="post-text" itemprop="text"> <p>I'm trying to encrypt a JSON string in C# en decrypt it in PHP by using OpenSSL RSA.</p> <p>The following code is in C#:</p> <pre><code>public static string EncryptData(string data) { string key = @"-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/J/txQvYBm5iOHRRRtgdXd5hq DEavxy5OExSiwjJgOgT72A9GX7+E7QYfhUZJTGtf+/J84tuJPx6/Ff1dZa1XRW84 /n5m7fw93CTVwpfRFi0Owenor44zgk6ABSfMlCzwGfdcS8AFiWCFUBpatKte6PaO /WfYK7qz/5faSp3FawIDAQAB -----END PUBLIC KEY-----"; OpenSSL.Crypto.CryptoKey pKey = OpenSSL.Crypto.CryptoKey.FromPublicKey(key, null); OpenSSL.Crypto.RSA rsa = pKey.GetRSA(); byte[] encryptedData = rsa.PublicEncrypt (Encoding.UTF8.GetBytes(data), OpenSSL.Crypto.RSA.Padding.PKCS1); rsa.Dispose(); return Convert.ToBase64String (encryptedData); } </code></pre> <p>then I send the encoded <code>encryptedData</code> to PHP and put it into the <code>PrivateKeyDecrypt</code> function.</p> <p>Code in PHP:</p> <pre><code>&lt;?php // include the lib //require_once('OpenSSL.php'); $ssl = new OpenSSL(); $ssl-&gt;loadPrivateKeyWithoutPath('-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQC+wVuIECnd7dvt7yqoElg4DL8jSKFpUavKfviSBE2Z+5z5YWnf i4mp/r0P0jVbE+dfqReaIr4UOt//hPvwvioAJ576KPOCTYZiIGehkqafGWS+01wH nAPSj/C7Xt7F9Mh5McH4CnBR5VN93KKZtQtfNsNPPBdXwQuquONOUgUgTwIDAQAB AoGAIQkvpvLVrV/CVQS0qIL00FA00hGEEs9YJyuyNOeV4PMYjn/2bAaogs5hQ9ot 72YVDhYkxkb6EFrZ7FDFqT3l2/BpQEsJ6/GQq2gX0rYGfJ5sWrN+KIuSJr4FWSN+ LrvIEr35hKHY6mytiQg9D58b5kSjaB9ea/qhh/hJL2VfWGECQQDlBBJsccR2ZzzH QN5omwFrUuxnqraY5LyZB8xUnqo9iDULO+GTcW/5eO9TBoWuDf1Ul3Snts9Tb+uD UYL1y5onAkEA1Ts182anQHCjUtp2hooLjDcOvIK3gi5TchqHW6T4K3tNtnbfOB9P gMNgcKljjXlQXl3ornvLTYBC483MS4RpmQJAZMiS9whmBhlOpP1GI1C7oih/Auwc qVJYMRw+bqrYjnWnqkby8XkFZwsyfx4qrDtZ1eVFIB2SRczGHyc688JjFwJBAIxa lx6J2VlfSwIEbrQMNaGrs/V9jVERMTgQIjy+j+P/G54ZDMEiSvCUqew+cxryWWZk Jf6D2cQ/wsez9N9YXzECQQDMH6jS9vp7aabI2UKy5RhTqvP6kRmi28/GHb/8QrFx tldiw2THvc4+4QT9tuv5OA6xRnEO5mt5u3vFHciqeRR7 -----END RSA PRIVATE KEY-----'); public function PrivateKeyDecrypt($raw_data, $base64 = TRUE) { if ($this-&gt;privateKey == NULL) trigger_error("Private key has not been specified.", E_USER_ERROR); if (!openssl_private_decrypt(($base64) ? base64_decode($raw_data) : $raw_data, $decrypted_data, $this-&gt;privateKey, $this-&gt;padding)) trigger_error("Unable to decrypt data.", E_USER_ERROR); return $decrypted_data; } </code></pre> <p>The error I get when I call the <code>PrivateKeyDecrypt</code> function is: </p> <pre><code>FATAL ERROR: unable to decrypt data in ... </code></pre> <p>Does anyone have any idea what causes this error? </p> </div>

如何修复Rijndael解密(php代码到python3迁移)IV问题?

<div class="post-text" itemprop="text"> <p>I'm migrating my existing code to Python3, unfortunately the decryption shows error that IV must be 16 bytes long.</p> <p>I have tried decrypting the key with sha1 then tried to decrypt.</p> <p>My php5.6 code is</p> <pre><code>&lt;?php define('ENCR_ALGO', MCRYPT_RIJNDAEL_256); define('ENCR_MODE', MCRYPT_MODE_CBC); define('KEY',"This is test key"); function encryptData($plaintext){ $iv=generateIv(); $ciphertext = mcrypt_encrypt(ENCR_ALGO, getKey(), $plaintext, ENCR_MODE, $iv); $ciphertext.=$iv; return trim(base64_encode($ciphertext)); } function decryptData($ciphertext){ $iv=getIvFromCiphertext($ciphertext); $ciphertext=getActualCiphertext($ciphertext); $plaintext = mcrypt_decrypt(ENCR_ALGO, getKey(), $ciphertext, ENCR_MODE, $iv); return trim($plaintext); } function getIvFromCiphertext($encryptedData){ $encryptedData = base64_decode($encryptedData); $cipherTextSize = strlen($encryptedData); $ivStartIndex = $cipherTextSize-ivSize(); return substr($encryptedData, $ivStartIndex , ivSize()); } function getActualCiphertext($encryptedData){ $encryptedData = base64_decode($encryptedData); $cipherTextSize = strlen($encryptedData); return substr($encryptedData, 0,$cipherTextSize-ivSize()); } function ivSize(){ return mcrypt_get_iv_size(ENCR_ALGO, ENCR_MODE); } function keySize(){ return mcrypt_get_key_size(ENCR_ALGO, ENCR_MODE); } function generateIv(){ return mcrypt_create_iv(keySize(), MCRYPT_RAND ); } function getKey(){ return substr(sha1(KEY), 0, keySize()); } echo "&lt;br/&gt;"; echo encryptData("my pass"); echo decryptData("vuv6kZgweA2YqSU4vMOuYStrbwZayDYaL7UQ+JajFCVc2p4HW1o68OmIm2l3Rbi/IaCWtKD5m6an7LqnvwRYVA=="); ?&gt; </code></pre> <p>In my python3 file, it's like</p> <pre><code>from hashlib import sha1 import base64 from Crypto import Random from Crypto.Cipher import AES def actual_text(txt): data = base64.b64decode(txt) return data[:32], data[32:64] passs = "vuv6kZgweA2YqSU4vMOuYStrbwZayDYaL7UQ+JajFCVc2p4HW1o68OmIm2l3Rbi/IaCWtKD5m6an7LqnvwRYVA==" key = "This is test key" text, iv = actual_text(passs) class Encryptor: def __init__(self, key): self.key = key def pad(self, s): return s + b"\0" * (AES.block_size - len(s) % AES.block_size) def encrypt(self, message, key, key_size=256): message = self.pad(message) iv = Random.new().read(AES.block_size) cipher = AES.new(key, AES.MODE_CBC, iv) return iv + cipher.encrypt(message) def decrypt(self, ciphertext, key, iv): # iv = ciphertext[:AES.block_size] cipher = AES.new(key, AES.MODE_CBC, iv) plaintext = cipher.decrypt(ciphertext[AES.block_size:]) return plaintext.rstrip(b"\0") def make_sha1(s, encoding='utf-8'): return sha1(s.encode(encoding)).hexdigest() make_sha1(key, encoding='utf-8') key2 = make_sha1(key, encoding='utf-8')[:32] print(iv) enc = Encryptor(key2) enc.decrypt(text,key2,iv) </code></pre> <p>The error is showing ValueError: IV must be 16 bytes long</p> <p>I've expected result is "my pass"</p> </div>

spring的@Component组件无法注入?

需要注入的类 ``` @Component public class WXConfig implements com.github.wxpay.sdk.WXPayConfig { /** * 服务器地址 */ @Value("${weChat.domain}") private String domain; /** * 商户Id */ @Value("${weChat.mchId}") private String mchId; /** * 支付key */ @Value("${weChat.key}") private String key; /** * appid */ @Value("${weChat.appId}") private String appId; /** * appSecret */ @Value("${weChat.appSecret}") private String appSecret; @Override public String getAppID() { return appId; } @Override public String getMchID() { return mchId; } @Override public String getKey() { return key; } @Override public InputStream getCertStream() { return null; } /** * 连接超时时间 * * @return */ @Override public int getHttpConnectTimeoutMs() { return 10 * 1000; } /** * 读取超时时间 * * @return */ @Override public int getHttpReadTimeoutMs() { return 10 * 1000; } public String getMchId() { return mchId; } public String getAppSecret() { return appSecret; } public String getGrantType() { return "authorization_code"; } /** * 回调地址 */ public String getNotifyURL() { return this.domain + "/order/wxPayUnifiedNotify"; } } ``` 调用的类 ``` /** * 微信相关 * * @author tangchao */ @Component public class WxUtil { @Autowired private WXConfig wxConfig; private final Logger LOG = LoggerFactory.getLogger(this.getClass()); /** * 用户登录 * * @param code 前端登录code * @param encryptedData 包括敏感数据在内的完整用户信息的加密数据 * @param iv 加密算法的初始向量 * @return 返回用户信息 nickName,avatarUrl,gender,unionid,city,province,country,openid * @throws Exception */ public JSONObject loginByWeixin(String code, String encryptedData, String iv) throws Exception { WxUtil wxUtil = new WxUtil(); //根据code去调用接口获取用户openid和session_key JSONObject json = wxUtil.getSessionKeyAndOpenid(code); System.out.println("返回过来的json数据:" + json.toString()); //会话秘钥 String sessionkey = json.get("session_key").toString(); //用户唯一标识 String openid = json.get("openid").toString(); //拿到用户session_key和用户敏感数据进行解密,拿到用户信息。 String decrypts = wxUtil.decrypt(encryptedData, sessionkey, iv, "utf-8"); JSONObject jsons = JSONObject.parseObject(decrypts); jsons.put("openid", openid); return jsons; } } ``` wxConfig报空指针,为什么?

用JS Forge解密PHP openssl_seal输出

<div class="post-text" itemprop="text"> <p>I am trying to decrypt my openssl_seal stored values. My PHP code:</p> <pre><code>public static function multiEncrypt( string $data, array $publicKeys ) : ?array { foreach ($publicKeys as $cert) { if (false === openssl_get_publickey( $cert )) { Log::getInstance()-&gt;error('multiEncrypt : invalid pubkey ; ' . openssl_error_string()); return null; } } $encryptedData = null; $encryptedKeys = []; $initVector = self::getInitVector( self::SEAL_CIPHER ); $result = openssl_seal( $data, $encryptedData, $encryptedKeys, $publicKeys, self::SEAL_CIPHER, $initVector ); if (false === $result) return null; $encodedData = base64_encode( $encryptedData ); $encodedKeys = []; foreach ($encryptedKeys as $key) { $encodedKeys[] = base64_encode($key); } return [ 'keys' =&gt; $encodedKeys, 'data' =&gt; $encodedData ]; } </code></pre> <p>and my client-side code:</p> <pre><code> function decrypt(privkey, blob, key) { var byteKey = forge.pki.privateKeyFromPem(privkey); var usrPubKey = forge.pki.publicKeyFromPem(publicKey); //var genPubKey = forge.pki.rsa.setPublicKey(byteKey.n, byteKey.e); /*if (usrPubKey !== genPubKey) { error('Your private key does not match the public key we have of you.'); return; }*/ console.log('Decoding key..'); var decodedKey = atob(key); console.log('Decrypting key..'); var contractUserKey = byteKey.decrypt(decodedKey); console.log(contractUserKey); console.log(contractUserKey.decrypt(blob)); } </code></pre> <p>However I keep getting 'forge.min.js:4068 Uncaught Error: Encryption block is invalid.'. Is there something I am missing here?</p> </div>

Java端的AES加密 - 在PHP端解密并选择单个密钥

<div class="post-text" itemprop="text"> <p>I am using AES and I want to settle for a key which I can use on the Java side to encrypt a string, I hardcode the same key on php side and decrypt the string if the strings match I am authenticated to step inside. </p> <p>Following is my code in Java: </p> <pre><code>public class AESencrp { private static final String ALGO = "AES"; private static final byte[] keyValue = new byte[] { 'T', 'h', 'e', 'B', 'e', 's', 't', 'S', 'e', 'c', 'r','e', 't', 'K', 'e', 'y' }; public static String encrypt(String Data) throws Exception { Key key = generateKey(); Cipher c = Cipher.getInstance(ALGO); c.init(Cipher.ENCRYPT_MODE, key); byte[] encVal = c.doFinal(Data.getBytes()); String encryptedValue = new BASE64Encoder().encode(encVal); return encryptedValue; } public static String decrypt(String encryptedData) throws Exception { Key key = generateKey(); Cipher c = Cipher.getInstance(ALGO); c.init(Cipher.DECRYPT_MODE, key); byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedData); byte[] decValue = c.doFinal(decordedValue); String decryptedValue = new String(decValue); return decryptedValue; } private static Key generateKey() throws Exception { Key key = new SecretKeySpec(keyValue, ALGO); return key; } } </code></pre> <p>Here is the function I use in PHP: </p> <pre><code>function fnDecrypt() { // echo $_POST['key']; $sValue = $_POST['key']; $sSecretKey = "TheBestSecretKey"; return rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $sSecretKey, base64_decode($sValue), MCRYPT_MODE_CBC, mcrypt_create_iv( mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC ), MCRYPT_RAND ) ), "\0" ); } </code></pre> <p>However it seems, that I always get different decrypted text on php side, I feel the issue is with the key, while as I am hard coding it, this behavior should not occur, any hints? </p> </div>

android安全存储,使用AndroidKeyStore的问题

最近在研究android的keystore安全存储,网上就一篇关于这个的博客,但是有些地方没讲清楚,资料非常少。。。 我使用以下方式存储了私钥和证书: mKeyStore = KeyStore.getInstance("AndroidKeyStore");//获取密钥库 KeyStore.PrivateKeyEntry expected = new KeyStore.PrivateKeyEntry(priKey, expectedChain); mKeyStore.setEntry("mytestRSAkey", expected, new KeyStoreParameter.Builder(this.getBaseContext()).setEncryptionRequired(true).build());//加密存储 现在我要提取公钥和私钥: actualEntry = mKeyStore.getEntry("mytestRSAkey",null);//获取密钥 KeyStore.PrivateKeyEntry actual = (KeyStore.PrivateKeyEntry) actualEntry; pubKey=actual.getCertificate().getPublicKey(); priKey=actual.getPrivateKey(); 可能是出于保护私钥的目的,priKey.getEncoded()是获取不到私钥的,只有一个密钥索引,导致我使用使用该私钥解密时出错 public static byte[] decrypt_RSA(byte[] encryptedData, PrivateKey privateKey) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(encryptedData); } catch (Exception e) { return null; } } 现在我该怎么使用priKey来解密数据啊

AES-256-CBC加密在golang和node / php之间不匹配

<div class="post-text" itemprop="text"> <p>I've been having a bit of problems trying to figure out why my encryption is different in go compared to php and node. I was hoping someone could help me figure out the differences. Let's assume this is the data:</p> <p>plaintext: <code>hello big worldshello big worlds</code></p> <p>key: <code>jJr44P3WSM5F8AC573racFpzU5zj7Rg5</code></p> <p>iv: <code>97iEhhtgVjoVwdUw</code></p> <p>Here are the resulting encryptions in base64:</p> <p><strong>Node and PHP return :</strong></p> <p><code>OTdpRWhodGdWam9Wd2RVd0OgJ+Z7pSCVioYq41721jarxqLKXN3PcnnY6/AOrHeEfsTxXfCgm2uUi+vmCAdpvw==</code></p> <p><strong>Go returns:</strong></p> <p><code>OTdpRWhodGdWam9Wd2RVd0OgJ+Z7pSCVioYq41721jarxqLKXN3PcnnY6/AOrHeE</code></p> <p>As you can see they're almost identical and its been driving me crazy. Could you guys take quick look at the encryption code below and give me hints on what the problem could be?</p> <p>GO:</p> <pre><code>func EncryptString(plainstring string, keystring string, encFormat int, ivOverride bool) (string) { // Load your secret key from a safe place and reuse it across multiple // NewCipher calls. (Obviously don't use this example key for anything // real.) If you want to convert a passphrase to a key, use a suitable // package like bcrypt or scrypt. key := []byte(keystring) plaintext := []byte(plainstring) // CBC mode works on blocks so plaintexts may need to be padded to the // next whole block. For an example of such padding, see // https://tools.ietf.org/html/rfc5246#section-6.2.3.2. Here we'll // assume that the plaintext is already of the correct length. if len(plaintext)%aes.BlockSize != 0 { panic("plaintext is not a multiple of the block size") } block, err := aes.NewCipher(key) if err != nil { panic(err) } // The IV needs to be unique, but not secure. Therefore it's common to // include it at the beginning of the ciphertext. ciphertext := make([]byte, aes.BlockSize+len(plaintext)) iv := ciphertext[:aes.BlockSize] if _, err := io.ReadFull(bytes.NewReader([]byte("97iEhhtgVjoVwdUw")), iv); err != nil { panic(err) } mode := cipher.NewCBCEncrypter(block, iv) mode.CryptBlocks(ciphertext[aes.BlockSize:], plaintext) // It's important to remember that ciphertexts must be authenticated // (i.e. by using crypto/hmac) as well as being encrypted in order to // be secure. return base64.StdEncoding.EncodeToString(ciphertext) } </code></pre> <p>NODE:</p> <pre><code>encryptString: function(string, key, fmt = null, ivOverride = false) { // Build an initialisation vector let iv; if(!ivOverride) { iv = crypto.randomBytes(IV_NUM_BYTES).toString('hex').slice(0,16); } else { iv = IV_OVERRIDE_VALUE; //97iEhhtgVjoVwdUw } // and encrypt let encryptor = crypto.createCipheriv('aes-256-cbc', key, iv); let encryptedData = encryptor.update(string, 'utf8', 'binary') + encryptor.final('binary'); encryptedData = iv+''+encryptedData; encryptedData = Buffer.from(encryptedData, 'binary').toString('base64'); return encryptedData; } </code></pre> <p>I've noticed that removing <code>encryptor.final('binary')</code> makes the two result in the same encryption but php does not have the .final() thing going for it. <code>Php uses open_ssl_encrypt()</code> which seems to have this built in. Is there a way to add an equivalent in go? Looking for advice. Thanks</p> </div>

软件测试入门、SQL、性能测试、测试管理工具

软件测试2小时入门,让您快速了解软件测试基本知识,有系统的了解; SQL一小时,让您快速理解和掌握SQL基本语法 jmeter性能测试 ,让您快速了解主流来源性能测试工具jmeter 测试管理工具-禅道,让您快速学会禅道的使用,学会测试项目、用例、缺陷的管理、

计算机组成原理实验教程

西北工业大学计算机组成原理实验课唐都仪器实验帮助,同实验指导书。分为运算器,存储器,控制器,模型计算机,输入输出系统5个章节

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

winfrom中嵌套html,跟html的交互

winfrom中嵌套html,跟html的交互,源码就在里面一看就懂,很简单

玩转Python-Python3基础入门

总课时80+,提供源码和相关资料 本课程从Python零基础到纯Python项目实战。内容详细,案例丰富,覆盖了Python知识的方方面面,学完后不仅对Python知识有个系统化的了解,让你从Python小白变编程大牛! 课程包含: 1.python安装 2.变量、数据类型和运算符 3.选择结构 4.循环结构 5.函数和模块 6.文件读写 7.了解面向对象 8.异常处理

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

基于VHDL的16位ALU简易设计

基于VHDL的16位ALU简易设计,可完成基本的加减、带进位加减、或、与等运算。

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

利用Verilog实现数字秒表(基本逻辑设计分频器练习)

设置复位开关。当按下复位开关时,秒表清零并做好计时准备。在任何情况下只要按下复位开关,秒表都要无条件地进行复位操作,即使是在计时过程中也要无条件地进行清零操作。 设置启/停开关。当按下启/停开关后,将

董付国老师Python全栈学习优惠套餐

购买套餐的朋友可以关注微信公众号“Python小屋”,上传付款截图,然后领取董老师任意图书1本。

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

计算机操作系统 第三版.pdf

计算机操作系统 第三版 本书全面介绍了计算机系统中的一个重要软件——操作系统(OS),本书是第三版,对2001年出版的修订版的各章内容均作了较多的修改,基本上能反映当前操作系统发展的现状,但章节名称基

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

SEIR课程设计源码与相关城市数据.rar

SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

定量遥感中文版 梁顺林著 范闻捷译

这是梁顺林的定量遥感的中文版,由范闻捷等翻译的,是电子版PDF,解决了大家看英文费时费事的问题,希望大家下载看看,一定会有帮助的

GIS程序设计教程 基于ArcGIS Engine的C#开发实例

张丰,杜震洪,刘仁义编著.GIS程序设计教程 基于ArcGIS Engine的C#开发实例.浙江大学出版社,2012.05

人工智能-计算机视觉实战之路(必备算法+深度学习+项目实战)

系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

去除异常值matlab程序

数据预处理中去除异常值的程序,matlab写成

用verilog HDL语言编写的秒表

在秒表设计中,分模块书写。用在七段数码管上显示。输入频率是1KHZ.可以显示百分秒,秒,分。如要显示小时,只需修改leds里的代码和主模块代码。改程序以通过硬件电路验证。完全正确。

[透视java——反编译、修补和逆向工程技术]源代码

源代码。

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问