X509Extension.java
资源名称:security.rar [点击查看]
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:1k
源码类别:
CA认证
开发平台:
Java
- package org.bouncycastle.asn1.x509;
- import org.bouncycastle.asn1.*;
- /**
- * an object for the elements in the X.509 V3 extension block.
- */
- public class X509Extension
- {
- boolean critical;
- ASN1OctetString value;
- public X509Extension(
- DERBoolean critical,
- ASN1OctetString value)
- {
- this.critical = critical.isTrue();
- this.value = value;
- }
- public X509Extension(
- boolean critical,
- ASN1OctetString value)
- {
- this.critical = critical;
- this.value = value;
- }
- public boolean isCritical()
- {
- return critical;
- }
- public ASN1OctetString getValue()
- {
- return value;
- }
- public int hashCode()
- {
- if (this.isCritical())
- {
- return this.getValue().hashCode();
- }
- return ~this.getValue().hashCode();
- }
- public boolean equals(
- Object o)
- {
- if (o == null || !(o instanceof X509Extension))
- {
- return false;
- }
- X509Extension other = (X509Extension)o;
- return other.getValue().equals(this.getValue())
- && (other.isCritical() == this.isCritical());
- }
- }