Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.crmf;
  
 
 public class EncKeyWithID
     extends ASN1Object
 {
     private final PrivateKeyInfo privKeyInfo;
     private final ASN1Encodable identifier;
 
     public static EncKeyWithID getInstance(Object o)
     {
         if (o instanceof EncKeyWithID)
         {
             return (EncKeyWithID)o;
         }
         else if (o != null)
         {
             return new EncKeyWithID(ASN1Sequence.getInstance(o));
         }
 
         return null;
     }
 
     private EncKeyWithID(ASN1Sequence seq)
     {
         this. = PrivateKeyInfo.getInstance(seq.getObjectAt(0));
 
         if (seq.size() > 1)
         {
             if (!(seq.getObjectAt(1) instanceof DERUTF8String))
             {
                 this. = GeneralName.getInstance(seq.getObjectAt(1));
             }
             else
             {
                 this. = (ASN1Encodable)seq.getObjectAt(1);
             }
         }
         else
         {
             this. = null;
         }
     }
 
     public EncKeyWithID(PrivateKeyInfo privKeyInfo)
     {
         this. = privKeyInfo;
         this. = null;
     }
 
     public EncKeyWithID(PrivateKeyInfo privKeyInfoDERUTF8String str)
     {
         this. = privKeyInfo;
         this. = str;
     }
 
     public EncKeyWithID(PrivateKeyInfo privKeyInfoGeneralName generalName)
     {
         this. = privKeyInfo;
         this. = generalName;
     }
 
     public PrivateKeyInfo getPrivateKey()
     {
         return ;
     }
 
     public boolean hasIdentifier()
     {
         return  != null;
     }
 
     public boolean isIdentifierUTF8String()
     {
         return  instanceof DERUTF8String;
     }
 
     public ASN1Encodable getIdentifier()
     {
         return ;
     }
    
    
 EncKeyWithID ::= SEQUENCE {
      privateKey           PrivateKeyInfo,
      identifier CHOICE {
         string               UTF8String,
         generalName          GeneralName
     } OPTIONAL
 }
 

Returns:
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        v.add();
        if ( != null)
        {
            v.add();
        }
        return new DERSequence(v);
    }
New to GrepCode? Check out our FAQ X