org.bouncycastle.asn1.ocsp.ResponderID Java Examples

The following examples show how to use org.bouncycastle.asn1.ocsp.ResponderID. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getResponderIdByName() {
   RespID responderId = this.ocsp.getResponderId();
   ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      return null;
   } else {
      ASN1Primitive derObject = derTaggedObject.getObject();
      X500Name name = X500Name.getInstance(derObject);
      return RFC2253Parser.normalize(name.toString());
   }
}
 
Example #2
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private byte[] getResponderIdByKey() {
   ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject();
      return keyHashOctetString.getOctets();
   } else {
      return new byte[0];
   }
}
 
Example #3
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getResponderIdByName() {
   RespID responderId = this.ocsp.getResponderId();
   ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      return null;
   } else {
      ASN1Primitive derObject = derTaggedObject.getObject();
      X500Name name = X500Name.getInstance(derObject);
      return RFC2253Parser.normalize(name.toString());
   }
}
 
Example #4
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private byte[] getResponderIdByKey() {
   ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject();
      return keyHashOctetString.getOctets();
   } else {
      return new byte[0];
   }
}
 
Example #5
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getResponderIdByName() {
   RespID responderId = this.ocsp.getResponderId();
   ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      return null;
   } else {
      ASN1Primitive derObject = derTaggedObject.getObject();
      X500Name name = X500Name.getInstance(derObject);
      return RFC2253Parser.normalize(name.toString());
   }
}
 
Example #6
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private byte[] getResponderIdByKey() {
   ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject();
      return keyHashOctetString.getOctets();
   } else {
      return new byte[0];
   }
}
 
Example #7
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getResponderIdByName() {
   RespID responderId = this.ocsp.getResponderId();
   ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      return null;
   } else {
      ASN1Primitive derObject = derTaggedObject.getObject();
      X500Name name = X500Name.getInstance(derObject);
      return RFC2253Parser.normalize(name.toString());
   }
}
 
Example #8
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private byte[] getResponderIdByKey() {
   ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject();
      return keyHashOctetString.getOctets();
   } else {
      return new byte[0];
   }
}
 
Example #9
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getResponderIdByName() {
   RespID responderId = this.ocsp.getResponderId();
   ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      return null;
   } else {
      ASN1Primitive derObject = derTaggedObject.getObject();
      X500Name name = X500Name.getInstance(derObject);
      return RFC2253Parser.normalize(name.toString());
   }
}
 
Example #10
Source File: OcspRef.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private byte[] getResponderIdByKey() {
   ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive();
   DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive();
   if (2 == derTaggedObject.getTagNo()) {
      ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject();
      return keyHashOctetString.getOctets();
   } else {
      return new byte[0];
   }
}
 
Example #11
Source File: OCSPTokenRefMatcher.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
private boolean matchByProperties(OCSPToken ocspToken, OCSPRef ocspRef) {
	if (ocspRef.getProducedAt().equals(ocspToken.getProductionDate())) {
		ResponderID tokenResponderId = ocspToken.getBasicOCSPResp().getResponderId().toASN1Primitive();
		ResponderId refResponderId = ocspRef.getResponderId();
		if (matchByKeyHash(tokenResponderId, refResponderId) || matchByName(tokenResponderId, refResponderId)) {
			return true;
		}
	}
	return false;
}
 
Example #12
Source File: OCSPTokenRefMatcher.java    From dss with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean matchByKeyHash(ResponderID tokenResponderId, ResponderId refResponderId) {
	return refResponderId.getSki() != null && Arrays.equals(refResponderId.getSki(), tokenResponderId.getKeyHash());
}
 
Example #13
Source File: OCSPTokenRefMatcher.java    From dss with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean matchByName(ResponderID tokenResponderId, ResponderId refResponderId) {
	return refResponderId.getX500Principal() != null && tokenResponderId.getName() != null
			&& refResponderId.getX500Principal().equals(DSSASN1Utils.toX500Principal(tokenResponderId.getName()));
}
 
Example #14
Source File: DSSRevocationUtils.java    From dss with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Transforms {@link RespID} to {@link ResponderId}
 * 
 * @param respID {@link RespID} to get values from
 * @return {@link ResponderId}
 */
public static ResponderId getDSSResponderId(RespID respID) {
	final ResponderID responderID = respID.toASN1Primitive();
	return getDSSResponderId(responderID);
}
 
Example #15
Source File: DSSRevocationUtils.java    From dss with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Transforms {@link ResponderID} to {@link ResponderId}
 * 
 * @param responderID {@link ResponderID} to get values from
 * @return {@link ResponderId}
 */
public static ResponderId getDSSResponderId(ResponderID responderID) {
	return new ResponderId(DSSASN1Utils.toX500Principal(responderID.getName()), responderID.getKeyHash());
}