Beispiel #1
0
 public IntPtr ToBin(out int size)
 {
   if (cb.Length!=16) throw new CKR_Exception(CK.CKR_MECHANISM_PARAM_INVALID);
   CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(0, 20);
   buf.Pack(ulCounterBits);
   buf.Pack(cb);
   size = buf.Size;
   return buf.Ptr;
 }
        public IntPtr ToBin(out int size)
        {
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(5, 0);

            buf.Pack(hardened);
            buf.Pack(ulChildNumber);
            size = buf.Size;
            return(buf.Ptr);
        }
        public IntPtr ToBin(out int size)
        {
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(isWindows?12:24, 0);

            buf.Pack(hashAlg);
            buf.Pack(mgf);
            buf.Pack(sLen);
            size = buf.Size;
            return(buf.Ptr);
        }
        public IntPtr ToBin(out int size)
        {
            int ulDataLen = pData == null ? 0 : pData.Length;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(isWindows?12:16, ulDataLen);

            buf.Pack(pData);
            buf.Pack(ulDataLen);
            size = buf.Size;
            return(buf.Ptr);
        }
Beispiel #5
0
        public IntPtr ToBin(out int size)
        {
            int ulFormatLen = pFormat == null ? 0 : pFormat.Length + 1;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(16, ulFormatLen);

            buf.Pack(ulMode);
            buf.Pack(pFormat);
            buf.Pack(ulMaxLen);
            size = buf.Size;
            return(buf.Ptr);
        }
        public IntPtr ToBin(out int size)
        {
            int ulTweakLen = pTweak == null ? 0 : pTweak.Length;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(20, ulTweakLen);

            buf.Pack(ulPurpose);
            buf.Pack(pTweak);
            buf.Pack(ulTweakLen);
            buf.Pack(ulSecretLen);
            size = buf.Size;
            return(buf.Ptr);
        }
Beispiel #7
0
 public IntPtr ToBin(out int size)
 {
   int ulSharedDataLen = pSharedData == null ? 0 : pSharedData.Length;
   int ulPublicDataLen = pPublicData == null ? 0 : pPublicData.Length;
   CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(isWindows ? 28 : 40, ulSharedDataLen + ulPublicDataLen);
   buf.Pack(kdf);
   buf.Pack(ulSharedDataLen);
   buf.Pack(pSharedData);
   buf.Pack(ulPublicDataLen);
   buf.Pack(pPublicData);
   size = buf.Size;
   return buf.Ptr;
 }
Beispiel #8
0
        public IntPtr ToBin(out int size)
        {
            int ulSourceDataLen           = pSourceData == null ? 0 : pSourceData.Length;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(24, ulSourceDataLen);

            buf.Pack(hashAlg);
            buf.Pack(mgf);
            buf.Pack(source);
            buf.Pack(pSourceData);
            buf.Pack(ulSourceDataLen);
            size = buf.Size;
            return(buf.Ptr);
        }
Beispiel #9
0
        public IntPtr ToBin(out int size)
        {
            int ulIvLen  = pIv == null ? 0 : pIv.Length;
            int ulAADLen = pAAD == null ? 0 : pAAD.Length;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(28, ulIvLen + ulAADLen);

            buf.Pack(pIv);
            buf.Pack(ulIvLen);
            buf.Pack(pAAD);
            buf.Pack(ulAADLen);
            buf.Pack(ulTagBits);
            size = buf.Size;
            return(buf.Ptr);
        }
        public IntPtr ToBin(out int size)
        {
            int ulLabelLen   = pLabel == null ? 0 : pLabel.Length;
            int ulContextLen = pContext == null ? 0 : pContext.Length;
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(isWindows?28:40, ulLabelLen + ulContextLen);

            buf.Pack(pLabel);
            buf.Pack(ulLabelLen);
            buf.Pack(pContext);
            buf.Pack(ulContextLen);
            buf.Pack(ulSecretLen);
            size = buf.Size;
            return(buf.Ptr);
        }
        public IntPtr ToBin(out int size)
        {
            CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(isWindows?4:8, 0);

            buf.Pack(ulBits);
            size = buf.Size;
            return(buf.Ptr);
        }
 public IntPtr ToBin(out int size)
 {
   int ulNonceLen = pNonce == null ? 0 : pNonce.Length;
   int ulAADLen   = pAAD   == null ? 0 : pAAD.Length;
   CK_MECHANISM_PARAM_Buffer buf = new CK_MECHANISM_PARAM_Buffer(32, ulNonceLen + ulAADLen);
   buf.Pack(ulDataLen);
   buf.Pack(pNonce);
   buf.Pack(ulNonceLen);
   buf.Pack(pAAD);
   buf.Pack(ulAADLen);
   buf.Pack(ulMACLen);
   size = buf.Size;
   return buf.Ptr;
 }