在使用 CryptoAPITransform进行加密时异常要调用Reset()

通过.net源码能看到Reset()里有

public void Reset() {
_depadBuffer = null;
// just ensure we've called CryptEncrypt with the true flag
byte[] temp = null;
Utils._EncryptData(_safeKeyHandle, EmptyArray<Byte>.Value, 0, 0, ref temp, 0, PaddingValue, true);
}

EmptyArray.Value 是只读的

PaddingValue 是加密解密的枚举类型 Mode

_depadBuffer 在 TransformFinalBlock里调用不到只在 TransformBlock里被new出来

Utils._EncryptData(_safeKeyHandle, EmptyArray<Byte>.Value, 0, 0, ref temp, 0, PaddingValue, true);

Utils里面的代码看不到,这里就猜测是SafeKeyHandle了

在使用 CryptoAPITransform进行加密时异常要调用Reset()的更多相关文章

  1. [No0000AE]在 Visual Studio 中调试 XAML 设计时异常

    在 Visual Studio 中进行 WPF, UWP, Silverlight 开发时,经常会遇到 XAML 设计器由于遭遇异常而无法正常显示设计器视图的情况.很多时候由于最终生成的项目在运行时并 ...

  2. XP机器上WCF采用X509证书加密时IIS读取证书的授权

    XP机器上WCF采用X509证书加密时IIS读取证书的授权 XP下的授权命令为:winhttpcertcfg -g -c LOCAL_MACHINE\My -s 证书名称 -a "ASPNE ...

  3. Visual Studio 2010编译时总是提示"调用目标发生了异常"的解决

    现象: 无论建立的是Win32 Console的解决方案,还是MFC的解决方案,重新打开Visual Studio 2010之后,编译时总是提示“调用的目标发生了异常” 解决: 1. 关闭Visual ...

  4. Java--RuntimeException(运行时异常)

    [转载自]:http://blog.csdn.net/qq7342272/article/details/7940741 java运行时异常是可能在java虚拟机正常工作时抛出的异常. java提供了 ...

  5. AES加密时抛出 Illegal key size or default parameters

    使用AES加密时,当密钥大于128时,代码会抛出java.security.InvalidKeyException: Illegal key size or default parameters Il ...

  6. java异常分类(运行时异常,可检查异常)

    NullPointerException:是运行时异常(RuntimeException),也叫非检查异常 所以我们抛出该类异常实例时,方法声明处无需添加throws来列举该类异常的抛出,编译器在编译 ...

  7. java 检查抛出的异常是否是要捕获的检查性异常或运行时异常或错误

    /** * Return whether the given throwable is a checked exception: * that is, neither a RuntimeExcepti ...

  8. AES加密时抛出java.security.InvalidKeyException: Illegal key size or def

    原文:AES加密时抛出java.security.InvalidKeyException: Illegal key size or def 使用AES加密时,当密钥大于128时,代码会抛出 java. ...

  9. android 运行时异常捕获

    1,将运行时异常捕获并存到手机SD卡上 可以直接使用logcat 命令Runtime.getRuntime().exec("logcat -f "+ file.getAbsolut ...

随机推荐

  1. 简单CSS3动画制作

    本贴已重新编辑至http://www.cnblogs.com/fastmover/p/4977358.html 最近需要用到了一些CSS3动画,基本用Animate.css(https://githu ...

  2. easyui datalist按组多选

    结果如下: 数据样式如下: [ {"text":"Epson WorkForce 845","group":"Printer&qu ...

  3. jQuery的.bind()、.live()和.delegate()之间区别

    摘要:jQuery的.bind()..live()和.delegate()之间的区别并非总是那么明显的,然而,如果我们对所有的不同之处都有清晰的理解的话,那么这将会有助于我们编写出更加简洁的代码,以及 ...

  4. ZeroMQ接口函数之 :zmq_msg_init_data - 从一个指定的存储空间中初始化一个ZMQ消息对象的数据

    ZeroMQ 官方地址 :http://api.zeromq.org/4-1:zmq_msg_init_data zmq_msg_init_data(3) ØMQ Manual - ØMQ/3.2.5 ...

  5. ImageLoader

    配置ImageLoader 一般我们在使用ImageLoader的时候,需要在应用程序的入口进行它的一个配置,这个配置一般写到Application里边 * public void initImage ...

  6. scala and machine learning

    http://download.csdn.net/album/detail/3376 scala and machine learning

  7. WPF整理--动态绑定到Logical Resource

    “What happens if we replace aspecific resource? Would that be reflected in all objects using the res ...

  8. “神马”框架之LigerUI

    我曾经参与一个产品的研发,前端框架用的就是LigerUI,之前我也没有听过这个框架. 因为是项目期初设计就定下来用LigerUI,根据系统的功能前端页面有跟多丰富的表现,所以需要改进前端效果,这次发现 ...

  9. JavaScript Array 常用函数整理

    按字母顺序整理 索引 Array.prototype.concat() Array.prototype.filter() Array.prototype.indexOf() Array.prototy ...

  10. asp.net mvc 表单相关

    1. <form action="/controller/action" method="post"> ... </form> *act ...