Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.cms;
  
RFC 5652: Content encryption key delivery mechanisms.
 RecipientIdentifier ::= CHOICE {
     issuerAndSerialNumber IssuerAndSerialNumber,
     subjectKeyIdentifier [0] SubjectKeyIdentifier 
 }

 SubjectKeyIdentifier ::= OCTET STRING
 
 
 public class RecipientIdentifier
     extends ASN1Object
     implements ASN1Choice
 {
     private ASN1Encodable id;
     
     public RecipientIdentifier(
         IssuerAndSerialNumber id)
     {
         this. = id;
     }
     
     public RecipientIdentifier(
         ASN1OctetString id)
     {
         this. = new DERTaggedObject(false, 0, id);
     }
     
     public RecipientIdentifier(
         ASN1Primitive id)
     {
         this. = id;
     }
    
    
Return a RecipientIdentifier object from the given object.

Accepted inputs:

  • null → null
  • RecipientIdentifier object
  • IssuerAndSerialNumber object
  • ASN1OctetString input formats (OctetString, byte[]) with value of KeyIdentifier in DER form
  • ASN1Primitive for RecipientIdentifier constructor

Parameters:
o the object we want converted.
Throws:
java.lang.IllegalArgumentException if the object cannot be converted.
 
     public static RecipientIdentifier getInstance(
         Object o)
     {
         if (o == null || o instanceof RecipientIdentifier)
         {
             return (RecipientIdentifier)o;
         }
         
         if (o instanceof IssuerAndSerialNumber)
         {
             return new RecipientIdentifier((IssuerAndSerialNumber)o);
         }
         
         if (o instanceof ASN1OctetString)
         {
             return new RecipientIdentifier((ASN1OctetString)o);
         }
         
         if (o instanceof ASN1Primitive)
         {
             return new RecipientIdentifier((ASN1Primitive)o);
         }
         
         throw new IllegalArgumentException(
           "Illegal object in RecipientIdentifier: " + o.getClass().getName());
     } 
 
     public boolean isTagged()
     {
         return ( instanceof ASN1TaggedObject);
     }
 
     public ASN1Encodable getId()
     {
         if ( instanceof ASN1TaggedObject)
         {
             return ASN1OctetString.getInstance((ASN1TaggedObject)false);
         }
        return IssuerAndSerialNumber.getInstance();
    }

    
Produce an object suitable for an ASN1OutputStream.
    {
        return .toASN1Primitive();
    }
New to GrepCode? Check out our FAQ X