Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.cms;
  
RFC 5084: CCMParameters object.

CCMParameters ::= SEQUENCE {
aes-nonce        OCTET STRING, -- recommended size is 12 octets
aes-ICVlen       AES-CCM-ICVlen DEFAULT 12 }
 
 
 public class CCMParameters
     extends ASN1Object
 {
     private byte[] nonce;
     private int icvLen;

    
Return an CCMParameters object from the given object.

Accepted inputs:

  • null → null
  • CCMParameters object
  • ASN1Sequence input formats with CCMParameters structure inside

Parameters:
obj the object we want converted.
Throws:
java.lang.IllegalArgumentException if the object cannot be converted.
 
     public static CCMParameters getInstance(
         Object  obj)
     {
         if (obj instanceof CCMParameters)
         {
             return (CCMParameters)obj;
         }
         else if (obj != null)
         {
             return new CCMParameters(ASN1Sequence.getInstance(obj));
         }
 
         return null;
     }
 
     private CCMParameters(
         ASN1Sequence seq)
     {
         this. = ASN1OctetString.getInstance(seq.getObjectAt(0)).getOctets();
 
         if (seq.size() == 2)
         {
             this. = ASN1Integer.getInstance(seq.getObjectAt(1)).getValue().intValue();
         }
         else
         {
             this. = 12;
         }
     }
 
     public CCMParameters(
         byte[] nonce,
         int icvLen)
     {
         this. = Arrays.clone(nonce);
         this. = icvLen;
     }
 
     public byte[] getNonce()
     {
         return Arrays.clone();
     }
 
     public int getIcvLen()
     {
         return ;
     }
 
     public ASN1Primitive toASN1Primitive()
     {
         ASN1EncodableVector    v = new ASN1EncodableVector();
 
         v.add(new DEROctetString());
 
         if ( != 12)
         {
             v.add(new ASN1Integer());
         }
 
        return new DERSequence(v);
    }
New to GrepCode? Check out our FAQ X