Skip to content

Commit 5cf4dc2

Browse files
aaron-boxerocrete
authored andcommitted
aes: add aes encryption and decryption elements
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1505>
1 parent 1a919a1 commit 5cf4dc2

14 files changed

+2350
-0
lines changed

docs/plugins/gst_plugins_cache.json

+206
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,212 @@
186186
"tracers": {},
187187
"url": "Unknown package origin"
188188
},
189+
"aes": {
190+
"description": "AES encryption/decryption plugin",
191+
"elements": {
192+
"aesdec": {
193+
"author": "Rabindra Harlalka <[email protected]>",
194+
"description": "AES buffer decryption",
195+
"hierarchy": [
196+
"GstAesDec",
197+
"GstBaseTransform",
198+
"GstElement",
199+
"GstObject",
200+
"GInitiallyUnowned",
201+
"GObject"
202+
],
203+
"klass": "Generic/Filter",
204+
"long-name": "aesdec",
205+
"pad-templates": {
206+
"sink": {
207+
"caps": "ANY",
208+
"direction": "sink",
209+
"presence": "always"
210+
},
211+
"src": {
212+
"caps": "ANY",
213+
"direction": "src",
214+
"presence": "always"
215+
}
216+
},
217+
"properties": {
218+
"cipher": {
219+
"blurb": "cipher mode",
220+
"conditionally-available": false,
221+
"construct": false,
222+
"construct-only": false,
223+
"controllable": false,
224+
"default": "aes-128-cbc (0)",
225+
"mutable": "ready",
226+
"readable": true,
227+
"type": "GstAesCipher",
228+
"writable": true
229+
},
230+
"iv": {
231+
"blurb": "AES encryption initialization vector (in hexadecimal). Length must equal AES block length (16 bytes)",
232+
"conditionally-available": false,
233+
"construct": false,
234+
"construct-only": false,
235+
"controllable": false,
236+
"default": "",
237+
"mutable": "ready",
238+
"readable": true,
239+
"type": "gchararray",
240+
"writable": true
241+
},
242+
"key": {
243+
"blurb": "AES encryption key (in hexadecimal). Length (in bytes) must be equivalent to the number of bits in the key length : 16 bytes for AES 128 and 32 bytes for AES 256",
244+
"conditionally-available": false,
245+
"construct": false,
246+
"construct-only": false,
247+
"controllable": false,
248+
"default": "",
249+
"mutable": "ready",
250+
"readable": true,
251+
"type": "gchararray",
252+
"writable": true
253+
},
254+
"per-buffer-padding": {
255+
"blurb": "If true, pad each buffer using PKCS7 padding scheme. Otherwise, onlypad final buffer",
256+
"conditionally-available": false,
257+
"construct": false,
258+
"construct-only": false,
259+
"controllable": false,
260+
"default": "true",
261+
"mutable": "ready",
262+
"readable": true,
263+
"type": "gboolean",
264+
"writable": true
265+
},
266+
"serialize-iv": {
267+
"blurb": "Read initialization vector from first 16 bytes of first buffer",
268+
"conditionally-available": false,
269+
"construct": false,
270+
"construct-only": false,
271+
"controllable": false,
272+
"default": "false",
273+
"mutable": "ready",
274+
"readable": true,
275+
"type": "gboolean",
276+
"writable": true
277+
}
278+
},
279+
"rank": "primary"
280+
},
281+
"aesenc": {
282+
"author": "Rabindra Harlalka <[email protected]>",
283+
"description": "AES buffer encryption",
284+
"hierarchy": [
285+
"GstAesEnc",
286+
"GstBaseTransform",
287+
"GstElement",
288+
"GstObject",
289+
"GInitiallyUnowned",
290+
"GObject"
291+
],
292+
"klass": "Generic/Filter",
293+
"long-name": "aesenc",
294+
"pad-templates": {
295+
"sink": {
296+
"caps": "ANY",
297+
"direction": "sink",
298+
"presence": "always"
299+
},
300+
"src": {
301+
"caps": "ANY",
302+
"direction": "src",
303+
"presence": "always"
304+
}
305+
},
306+
"properties": {
307+
"cipher": {
308+
"blurb": "cipher mode",
309+
"conditionally-available": false,
310+
"construct": false,
311+
"construct-only": false,
312+
"controllable": false,
313+
"default": "aes-128-cbc (0)",
314+
"mutable": "ready",
315+
"readable": true,
316+
"type": "GstAesCipher",
317+
"writable": true
318+
},
319+
"iv": {
320+
"blurb": "AES encryption initialization vector (in hexadecimal). Length must equal AES block length (16 bytes)",
321+
"conditionally-available": false,
322+
"construct": false,
323+
"construct-only": false,
324+
"controllable": false,
325+
"default": "",
326+
"mutable": "ready",
327+
"readable": true,
328+
"type": "gchararray",
329+
"writable": true
330+
},
331+
"key": {
332+
"blurb": "AES encryption key (in hexadecimal). Length (in bytes) must be equivalent to the number of bits in the key length : 16 bytes for AES 128 and 32 bytes for AES 256",
333+
"conditionally-available": false,
334+
"construct": false,
335+
"construct-only": false,
336+
"controllable": false,
337+
"default": "",
338+
"mutable": "ready",
339+
"readable": true,
340+
"type": "gchararray",
341+
"writable": true
342+
},
343+
"per-buffer-padding": {
344+
"blurb": "If true, pad each buffer using PKCS7 padding scheme. Otherwise, onlypad final buffer",
345+
"conditionally-available": false,
346+
"construct": false,
347+
"construct-only": false,
348+
"controllable": false,
349+
"default": "true",
350+
"mutable": "ready",
351+
"readable": true,
352+
"type": "gboolean",
353+
"writable": true
354+
},
355+
"serialize-iv": {
356+
"blurb": "Store initialization vector in first 16 bytes of first buffer",
357+
"conditionally-available": false,
358+
"construct": false,
359+
"construct-only": false,
360+
"controllable": false,
361+
"default": "false",
362+
"mutable": "ready",
363+
"readable": true,
364+
"type": "gboolean",
365+
"writable": true
366+
}
367+
},
368+
"rank": "primary"
369+
}
370+
},
371+
"filename": "gstaes",
372+
"license": "LGPL",
373+
"other-types": {
374+
"GstAesCipher": {
375+
"kind": "enum",
376+
"values": [
377+
{
378+
"desc": "AES 128 bit cipher key using CBC method",
379+
"name": "aes-128-cbc",
380+
"value": "0"
381+
},
382+
{
383+
"desc": "AES 256 bit cipher key using CBC method",
384+
"name": "aes-256-cbc",
385+
"value": "1"
386+
}
387+
]
388+
}
389+
},
390+
"package": "GStreamer Bad Plug-ins",
391+
"source": "gst-plugins-bad",
392+
"tracers": {},
393+
"url": "Unknown package origin"
394+
},
189395
"aiff": {
190396
"description": "Create and parse Audio Interchange File Format (AIFF) files",
191397
"elements": {

ext/aes/gstaes.c

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* GStreamer gstreamer-aes
3+
*
4+
* Copyright, 2021 Nice, Contact: Rabindra Harlalka <[email protected]>
5+
*
6+
* gstaes.c
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Library General Public
10+
* License as published by the Free Software Foundation; either
11+
* version 2 of the License, or (at your option) any later version.
12+
*
13+
* This library is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
* Library General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Library General Public
19+
* License along with this library; if not, write to the
20+
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21+
* Boston, MA 02110-1301, USA.
22+
*/
23+
24+
#ifdef HAVE_CONFIG_H
25+
#include "config.h"
26+
#endif
27+
28+
#include "gstaesdec.h"
29+
#include "gstaesenc.h"
30+
31+
/**
32+
* SECTION:plugin-aes
33+
*
34+
* AES encryption and decryption
35+
*
36+
* See also: @aesenc, @aesdec
37+
* Since: 1.20
38+
*/
39+
40+
41+
static gboolean
42+
plugin_init (GstPlugin * plugin)
43+
{
44+
gboolean success = GST_ELEMENT_REGISTER (aesenc, plugin);
45+
success = GST_ELEMENT_REGISTER (aesdec, plugin) || success;
46+
47+
return success;
48+
}
49+
50+
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
51+
GST_VERSION_MINOR,
52+
aes,
53+
"AES encryption/decryption plugin",
54+
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);

0 commit comments

Comments
 (0)