Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
The BSD License Copyright (c) 2010-2012 RIPE NCC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the RIPE NCC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 package net.ripe.rpki.commons.crypto.cms;
 
 
 import java.net.URI;
 
 public abstract class RpkiSignedObject implements CertificateRepositoryObject {
 
     private static final long serialVersionUID = 1L;
 
     public static final String RSA_ENCRYPTION_OID = .;
 
     // The "sha256WithRsa" Object Id is defined in RFC6485 but no existing implementations, at least bouncy castle and
     // openssl support this. There is a plan to issue an erratum for RFC6485 to just go with plain "rsa" as existing
     // implementations are doing. Until that time, we had better accept both when doing validation.
The digestAlgorithms set MUST include only SHA-256, the OID for which is 2.16.840.1.101.3.4.2.1. [RFC4055] It MUST NOT contain any other algorithms.
 
     public static final String DIGEST_ALGORITHM_OID = .;
 
     private byte[] encoded;
 
 
     private String oid// Storing oid as String  so that this class is serializable
 
     private DateTime signingTime;
 
     protected RpkiSignedObject(RpkiSignedObjectInfo cmsObjectData) {
         this(cmsObjectData.getEncoded(), cmsObjectData.getCertificate(), cmsObjectData.getContentType(), cmsObjectData.getSigningTime());
     }
 
     protected RpkiSignedObject(byte[] encodedX509ResourceCertificate certificateASN1ObjectIdentifier oidDateTime signingTime) { //NOPMD - ArrayIsStoredDirectly
         this. = encoded;
         this. = certificate;
         this. = oid.getId();
         this. = signingTime;
     }
 
     @Override
     public byte[] getEncoded() {
         return ;
     }
 
     public DateTime getSigningTime() {
         return ;
     }
 
     public ASN1ObjectIdentifier getContentType() {
        return new ASN1ObjectIdentifier();
    }
        return ;
    }
    public boolean signedBy(X509ResourceCertificate certificate) {
        return this..equals(certificate);
    }
    public ValidityPeriod getValidityPeriod() {
        return .getValidityPeriod();
    }
    public DateTime getNotValidBefore() {
    }
    public DateTime getNotValidAfter() {
    }
        return getCertificate().getIssuer();
    }
        return getCertificate().getSubject();
    }
    @Override
    public URI getCrlUri() {
    }
    @Override
    public void validate(String locationCertificateRepositoryObjectValidationContext contextCrlLocator crlLocatorValidationOptions optionsValidationResult result) {
        ValidationLocation savedCurrentLocation = result.getCurrentLocation();
        result.setLocation(new ValidationLocation(getCrlUri()));
        X509Crl crl = crlLocator.getCrl(getCrlUri(), contextresult);
        result.setLocation(savedCurrentLocation);
        if (crl == null) {
            return;
        }
        X509ResourceCertificateValidator validator = new X509ResourceCertificateParentChildValidator(optionsresultcontext.getCertificate(), crlcontext.getResources());
        validator.validate(locationgetCertificate());
    }
    @Override
    public int hashCode() {
        return Arrays.hashCode(getEncoded());
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final RpkiSignedObject other = (RpkiSignedObjectobj;
        return Arrays.equals(getEncoded(), other.getEncoded());
    }
New to GrepCode? Check out our FAQ X