本文整理了Java中org.bouncycastle.asn1.ASN1Object
类的一些代码示例,展示了ASN1Object
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ASN1Object
类的具体详情如下:
包路径:org.bouncycastle.asn1.ASN1Object
类名称:ASN1Object
[英]Base class for defining an ASN.1 object.
[中]用于定义ASN的基类。1对象。
代码示例来源:origin: apache/pdfbox
private TimeStampToken extractTimeStampTokenFromSignerInformation(SignerInformation signerInformation)
throws CMSException, IOException, TSPException
{
if (signerInformation.getUnsignedAttributes() == null)
{
return null;
}
AttributeTable unsignedAttributes = signerInformation.getUnsignedAttributes();
// https://stackoverflow.com/questions/1647759/how-to-validate-if-a-signed-jar-contains-a-timestamp
Attribute attribute = unsignedAttributes.get(
PKCSObjectIdentifiers.id_aa_signatureTimeStampToken);
if (attribute == null)
{
return null;
}
ASN1Object obj = (ASN1Object) attribute.getAttrValues().getObjectAt(0);
CMSSignedData signedTSTData = new CMSSignedData(obj.getEncoded());
return new TimeStampToken(signedTSTData);
}
代码示例来源:origin: com.google.code.jscep/jscep-api
private X509CertificateStructure getCertificate() {
try {
ASN1Sequence seq = (ASN1Sequence) ASN1Object.fromByteArray(identity.getEncoded());
X509CertificateStructure x509 = new X509CertificateStructure(seq);
return x509;
} catch (CertificateEncodingException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
/**
* @deprecated use toASN1Primitive()
* @return the underlying primitive type.
*/
public ASN1Primitive toASN1Object()
{
return this.toASN1Primitive();
}
代码示例来源:origin: com.google.code.jscep/jscep-api
algParams.init(params.getEncoded());
final byte[] content = msgCipher.doFinal(encryptedContent.getOctets());
msgData = ASN1Object.fromByteArray(content);
} catch (GeneralSecurityException e) {
throw new IOException(e);
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public int hashCode()
{
if (!isHashCodeSet)
{
hashCodeValue = super.hashCode();
isHashCodeSet = true;
}
return hashCodeValue;
}
}
代码示例来源:origin: org.nhind/agent
private boolean isIssuerInAnchors(Collection<X509Certificate> anchors, X509Certificate checkIssuer)
{
final ASN1Object checkIssuerExValue = getExtensionValue(checkIssuer, "2.5.29.14");
for (X509Certificate anchor : anchors)
{
if (Thumbprint.toThumbprint(anchor).equals(Thumbprint.toThumbprint(checkIssuer)))
return true; // already found the certificate issuer... done
// thumbprint may not be enough... it is possible that there might be change of anchors but they keep the same subject key id
final ASN1Object anchorExValue = getExtensionValue(anchor, "2.5.29.14");
if (checkIssuerExValue != null && anchorExValue != null && anchorExValue.equals(checkIssuerExValue))
return true;
}
return false;
}
代码示例来源:origin: redfish64/TinyTravelTracker
public int hashCode()
{
if (!isHashCodeSet)
{
hashCodeValue = super.hashCode();
isHashCodeSet = true;
}
return hashCodeValue;
}
}
代码示例来源:origin: com.google.code.jscep/jscep-api
private DEREncodableVector getCertificatesVector() throws IOException {
final DEREncodableVector v = new ASN1EncodableVector();
for (Certificate cert : certs) {
try {
v.add(ASN1Object.fromByteArray(cert.getEncoded()));
} catch (CertificateEncodingException e) {
// This is thrown if an encoding error occurs.
throw new IOException(e);
}
}
return v;
}
代码示例来源:origin: kaikramer/keystore-explorer
@Override
public boolean equals(Object paramObject) {
if (paramObject == null) {
return false;
}
try {
return Arrays.equals(((ASN1Object) paramObject).getEncoded(), getEncoded());
} catch (Exception e) {
// ignore
}
return false;
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* @deprecated use toASN1Primitive()
* @return the underlying primitive type.
*/
public ASN1Primitive toASN1Object()
{
return this.toASN1Primitive();
}
代码示例来源:origin: com.hynnet/jradius-extended
/**
* Create a private key parameter from a PKCS8 PrivateKeyInfo encoding.
*
* @param privateKeyInfoData the PrivateKeyInfo encoding
* @return a suitable private key parameter
* @throws IOException on an error decoding the key
*/
public static AsymmetricKeyParameter createKey(
byte[] privateKeyInfoData)
throws IOException
{
return createKey(
PrivateKeyInfo.getInstance(
ASN1Object.fromByteArray(privateKeyInfoData)));
}
代码示例来源:origin: eu.eu-emi.security/canl
private byte[] calculateSignature(String sigName, String provider, PrivateKey key,
SecureRandom random, ASN1Object object)
throws IOException, NoSuchProviderException,
NoSuchAlgorithmException, InvalidKeyException,
SignatureException
{
Signature sig;
if (provider != null)
sig = Signature.getInstance(sigName, provider);
else
sig = Signature.getInstance(sigName);
if (random != null)
sig.initSign(key, random);
else
sig.initSign(key);
sig.update(object.getEncoded(ASN1Encoding.DER));
return sig.sign();
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public int hashCode()
{
return this.toASN1Primitive().hashCode();
}
代码示例来源:origin: net.jradius/jradius-extended
/**
* Create a private key parameter from a PKCS8 PrivateKeyInfo encoding.
*
* @param privateKeyInfoData the PrivateKeyInfo encoding
* @return a suitable private key parameter
* @throws IOException on an error decoding the key
*/
public static AsymmetricKeyParameter createKey(
byte[] privateKeyInfoData)
throws IOException
{
return createKey(
PrivateKeyInfo.getInstance(
ASN1Object.fromByteArray(privateKeyInfoData)));
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
private static byte[] getEncodedVector(ASN1EncodableVector vec)
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
for (int i = 0; i != vec.size(); i++)
{
try
{
bOut.write(((ASN1Object)vec.get(i)).getEncoded(ASN1Encoding.DER));
}
catch (IOException e)
{
throw new ASN1ParsingException("malformed object: " + e, e);
}
}
return bOut.toByteArray();
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public ASN1Primitive toASN1Primitive()
{
if (integrityCheck instanceof SignatureCheck)
{
return new DERTaggedObject(0, integrityCheck);
}
return integrityCheck.toASN1Primitive();
}
}
代码示例来源:origin: com.google.code.jscep/jscep-api
private DEREncodableVector getCRLsVector() throws IOException {
final DEREncodableVector v = new ASN1EncodableVector();
for (CRL crl : crls) {
final X509CRL x509crl = (X509CRL) crl;
try {
v.add(ASN1Object.fromByteArray(x509crl.getEncoded()));
} catch (CRLException e) {
// This is thrown if an encoding error occurs.
throw new IOException(e);
}
}
return v;
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
private static byte[] getEncodedVector(ASN1EncodableVector vec)
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
for (int i = 0; i != vec.size(); i++)
{
try
{
bOut.write(((ASN1Object)vec.get(i)).getEncoded(ASN1Encoding.BER));
}
catch (IOException e)
{
throw new ASN1ParsingException("malformed object: " + e, e);
}
}
return bOut.toByteArray();
}
代码示例来源:origin: redfish64/TinyTravelTracker
public int hashCode()
{
return this.toASN1Primitive().hashCode();
}
代码示例来源:origin: org.codeartisans.qipki/qipki-crypto
@Override
public String getNetscapeCertComment( X509Certificate cert )
{
try {
byte[] value = cert.getExtensionValue( MiscObjectIdentifiers.netscapeCertComment.getId() );
if ( value == null ) {
return null;
}
return ASN1Object.fromByteArray( value ).toString();
} catch ( IOException ex ) {
throw new CryptoFailure( "Unable to extract NetscapeCertComment from X509Certificate extensions", ex );
}
}
内容来源于网络,如有侵权,请联系作者删除!